Following is the build.gradle code in Android Studio
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.sg.blahblah"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
lintOptions {
checkReleaseBuilds true
abortOnError false
xmlReport true
htmlReport true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
lintOptions {
disable 'MissingTranslation'
}
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.google.android.apps.dashclock:dashclock-api:+'
compile 'com.roughike:bottom-bar:1.4.0.1'
compile 'com.diogobernardino:williamchart:2.2'
}
I am getting the below error: Error:A problem occurred configuring project ':app'.
Failed to notify project evaluation listener. com.android.build.gradle.tasks.factory.AndroidJavaCompile.setDependencyCacheDir(Ljava/io/File;)V
Can anyone please help?
The problem is probably you're using a Gradle version rather than 3. go to gradle/wrapper/gradle-wrapper.properties and change the last line to this:
It is interesting but as for me help this:
I also encountered this error when updating to
'com.android.tools.build:gradle:3.0.0'
To fix it, I had to add the
google()
repo to both the buildscript and module repositories. The documentation here only mentions adding to to the buildscript.Project-level build.gradle
App-level build.gradle
gradle-wrapper.properties
Usually it depends on Instant run or Gradle, but I tried both variants and nothing helped me. Then I looked through
idea.log
and saw this errorI really don't know why this error is not shown in
Gradle Console
orEvent Log
tab. Then I fixed it by adding some code to the end ofandroid{}
block.I had
buildToolsVersion "27.0.1"
, upgrading it to27.0.2
fixed the issue.Also, my android support deps were at version
27.0.2
so they were not aligned to thebuildToolsVersion
For those of you working on a team:
I pulled down some changes that included updating the build tools version, but I had not downloaded that new version of the build tools on my machine. Downloading the new version fixed this issue for me