Android Studio:未找到构建变体错误 [英] Android Studio: No build variant found error

查看:45
本文介绍了Android Studio:未找到构建变体错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 android 开发的新手,我开始从头开始开发一个我在线购买的项目,按照文档,我遇到了一个错误,说 没有找到应用程序"的变体.检查构建文件以确保至少存在一个变体.

i am new to android development, i started developing from scratch on a project i bought online, following the documentation, i encountered a error saying No variants found for 'app'. Check build files to ensure at least one variant exists.

这里是 build.gradle 代码

Here is the build.gradle code

apply plugin: 'com.android.application'

android {
compileSdkVersion 29
buildToolsVersion "29.0.1"
defaultConfig {
    applicationId "com.app-10.app"
    minSdkVersion 23
    targetSdkVersion 29
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.vectordrawable:vectordrawable:1.0.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
// Third Party Libraries
//Glide library for image fetching from the web
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
//Material library for styling blocks
implementation 'com.google.android.material:material:1.0.0'
// Google Gson
implementation 'com.google.code.gson:gson:2.8.5'
// Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.6.1'
implementation 'com.squareup.retrofit2:converter-gson:2.6.1'
// Android-SpinKit
implementation 'com.github.ybq:Android-SpinKit:1.4.0'

implementation files('libs/YouTubeAndroidPlayerApi.jar')

// gotev/android-upload-service
implementation "net.gotev:uploadservice:3.5.2"

//A fast circular ImageView perfect for profile images
implementation 'de.hdodenhof:circleimageview:3.0.1'

implementation 'org.apache.commons:commons-io:1.3.2'

}

推荐答案

我刚刚解决了同样的问题,如下所示:

I have just solved the same issue like this:

工具 ->SDK 管理器

验证 Android 10.0(具有 API 级别 29 的 SDK 平台包,如您在 gradle 文件中定义的)是否已检查.如果没有,请检查它并应用更改.接受许可条款,安装软件包,然后 File ->将项目与 Gradle 文件同步(或再次打开项目)

Verify that the SDK platform package for Android 10.0 (the one with API level 29, like you defined in your gradle file) is checked. If not, check it and apply changes. Accept the licence terms, install the package and then File -> Sync Project with Gradle Files (or open the project again)

这篇关于Android Studio:未找到构建变体错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆