首页 > 解决方案 > Android工作室:未找到变体

问题描述

在此处输入图像描述 您好,我正在学习新的 Android Studio,我从 CodeCanyon 购买了源代码并解决了一些错误,但我陷入了这个错误:没有为 ':app' 找到变体。检查构建文件以确保至少存在一种变体。我检查了 cdk 工具,一切似乎都很好,我也搜索了答案并尝试了它们,但我无法解决这个错误。

这是我的代码:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29

    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId 'com.quraan.farroukh'
        minSdkVersion 17
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        ndk {
            ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
        }


    }

    lintOptions {

        checkReleaseBuilds false

    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        }
    }


    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    productFlavors {


    }
}


dependencies{
    task wrapper(type: Wrapper){
        gradleVersion = '2.14.1'
    }
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.google.android.material:material:1.3.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.browser:browser:1.3.0'
    implementation 'androidx.recyclerview:recyclerview:1.2.1'
    implementation 'com.google.android.gms:play-services-ads:20.2.0'
    implementation 'com.google.android.gms:play-services-analytics:17.0.0'
    implementation 'com.google.android.gms:play-services-analytics-impl:17.0.0'
    implementation 'com.github.varunest:sparkbutton:1.0.6'
    implementation 'com.airbnb.android:lottie:3.6.1'
    implementation 'com.github.glomadrian:Grav:1.1'
    implementation 'hanks.xyz:htextview-library:0.1.5'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'com.intuit.sdp:sdp-android:1.0.6'
    implementation 'io.saeid:fab-loading:1.0.0'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.balysv:material-ripple:1.0.2'
    implementation 'de.hdodenhof:circleimageview:3.1.0'

}

标签: android

解决方案


我猜,您可能没有安装 SDK 29。转到文件->设置->外观和行为->系统设置->Android SDK 检查 API 级别的特定版本,如果缺少,请安装它


推荐阅读