Skip to content Skip to sidebar Skip to footer

Android Studio: No Build Variant Found Error

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 'ap

Solution 1:

I have just solved the same issue like this:

Tools -> SDK Manager

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)

Solution 2:

go to the SDK manager (Ctrl+Shift+A then write SDK manager), install the android version of current project, in this case I installed all the available options starting from 5.0

Solution 3:

I replaced from:

dependencies {
    classpath 'com.android.tools.build:gradle:3.2.1'// NOTE: Do not place your application dependencies here; they belong// in the individual module build.gradle files
}

to my Android Studio v3.0.1 in my case:

dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'// NOTE: Do not place your application dependencies here; they belong// in the individual module build.gradle files
}

but at the end i resolve it by

you need to detect your proper sdk

you need to detect and set your proper sdk

my sdk is 30.0.2 after i install 29.0.2 this error gone

Solution 4:

In my case, it is because I add flavourDimensions and not adding it to any productFlavors

example from my case I have in my build.gradle in app level:

flavorDimensions "stage", "mode"

and my productFlavors:

productFlavors {
    dev {
        dimension "stage"
        //noinspection DevModeObsolete
        minSdkVersion 21
        versionNameSuffix "-dev"
        applicationIdSuffix '.dev'
        resConfigs "en", "xxhdpi"
    }
    
    prod {
        dimension "stage"
        minSdkVersion 21
        versionNameSuffix "-prod"
        applicationIdSuffix '.prod'
    }
}

As you can see here, I don't use flavorDimensions"mode" in any of my productFlavors. So, when I try to sync my gradle. It gives me that error

Solution 5:

Might help someone, in my case, I just needed to update Gradle.

A warning popped up on Android Studio, so I updated it, and then worked properly 🤷🏻‍♀️

Post a Comment for "Android Studio: No Build Variant Found Error"