apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply plugin: "org.jetbrains.kotlin.android.extensions"
android {
compileSdkVersion 27
buildToolsVersion '27.0.1'
defaultConfig {
applicationId "com.appsmartz.wallzypremiumwallpapers"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
dataBinding {
enabled true
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }
productFlavors {
androidExtensions {
experimental = true
ext.supportLibVersion = '27.0.2'
ext.firebaseVersion = '11.6.2'
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile "com.android.support:palette-v7:$supportLibVersion"
compile "com.google.firebase:firebase-ads:$firebaseVersion"
compile "com.google.firebase:firebase-core:$firebaseVersion"
compile "com.google.firebase:firebase-database:$firebaseVersion"
compile "com.google.firebase:firebase-storage:$firebaseVersion"
compile "com.google.firebase:firebase-auth:$firebaseVersion"
compile "com.google.android.gms:play-services-auth:$firebaseVersion"
compile 'com.android.support:multidex:1.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'me.relex:circleindicator:1.2.2@aar'
compile 'com.facebook.android:facebook-android-sdk:4.29.0'
compile 'com.mikhaellopez:circularfillableloaders:1.2.0'
compile 'pub.devrel:easypermissions:0.4.2'
// compile 'com.jakewharton.timber:timber:4.5.1'
kapt 'com.android.databinding:compiler:3.0.1'
compile project(':utilities')
repositories {
mavenCentral()
google()
apply plugin: 'com.google.gms.google-services'
–
Well, since everything was right in my case, this had to be a gradle issue(bug probably). This happens mostly due to implementation(project-lib) part, probably when the project is added for the first time, or when due to any issue the project-lib module fails to build, and this error occurs in the subsequent tries to build the project, even if the issues are addressed.
I suppose there's some kind of cyclic dependency that triggers this. So the hack to go around this are the following steps.
1. Go to build.gradle inside app folder, and comment out the implementation(project-lib) dependency.
2. Press Sync Now on the option that appears after changing anything in gradle.
You don't get an error, good. You get one? Better. In any case proceed.
3. Go to the Gradle option on right side of the studio(look at the right edge) press it, click on main-project, you will see your project-lib option, click it, then ->Tasks->Build->Assemble Debug and Assemble Release.
If you don't see your project-lib there, you have to delete all build folders and iml files manually, invalidate caches and restart. You will then see your project.
4. Uncomment the dependency line in your app level build.gradle, that you previously commented, and DO NOT press Sync Now. Go to -> Build-> Rebuild project. Then if the Sync now option is still there, you can sync.
Now the error will be gone.
N.B This answer is after you ensure, there are no loopholes from your side.
If this problem is popping on Flutter then,
Open your build.gradle
file in android
folder. (not in app)
inside dependency
block, update classpath of tools.build.gradle
like this,
dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
Check gradle version. gradle -v
Check gradle version and gradle plugin version compatible or Not
Example:
gradle 4.6 is not compatible with gradle plugin 2.2.
so update com.android.tools.build:gradle version to 2.3.3.
then you need check gradle/wrapper/gradle-wrapper.properties distributionUrl gradle version
Here's what I did to get a fix to the same problem. I went into the Gradle window and look at the dependencies. In my case when I looked at my buildSrc dependencies I noticed that the compileClassPath and the runtimeClassPath both used different versions of "org.jetbrain.kotlin:kotlin-stdlib-jdk". That focused me on looking at my root build.gradle.kts and my buildSrc build.gradle.kts and the two were using different versions of "org.gradle.kotlin:gradle-kotlin-dsl-plugins". I corrected them to be the same version and this problem went away! I suspect that this same problem could happen if you mismatch versions of other dependencies. So hopefully my explanation helps with an approach on how to find version mismatches.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.