The module 'app' is an Android project without build variants

Try use command line to run gradlew tasks to see why the build would fail.

In my case:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
 platforms;android-27 Android SDK Platform 27
 build-tools;27.0.3 Android SDK Build-Tools 27.0.3

So I just ran Go to Android\sdk\tools\bin sdkmanager --licenses to accept licenses and then the build passed in command line.

I think Android Studio is crying for the wrong issue. So you may check the real output in command line and find what is happening.


Just install the Android SDK platform package through SDK Manager in Android Studio, relevant to your Compile SDK version. It will prompt you to install the package as well as to accept the license. After that just sync the gradle, it will resolve the issue.


For me, this issue appeared when I updated Android Studio to version 3.3.
Disabling experimental feature "Only sync the active variant" fixes it:

enter image description here


Above gradle file code seems to be perfect. Probably its nothing to do with app/build.gradle (Module:app). Just open other build.gradle (Project:Android) file in Project window and verify your Android Studio version it must be same as yours.

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
}

Press "Try Again" to Sync gradle file. This resolved my problem with a successful build.