'gradle ASCII: A problem occurred evaluating project ':app'
Friday gradle works fine, today I got this gradle error:
* Where:
Build file '...\git\project\app\build.gradle' line: 1
* What went wrong:
A problem occurred evaluating project ':app'.
> ASCII
CONFIGURE FAILED in 4s
ASCII
error with gradle --debug
:
...
10:29:50.018 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
10:29:50.018 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
10:29:50.018 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
10:29:50.018 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Where:
10:29:50.019 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Build file '...\git\project\project\build.gradle' line: 1
10:29:50.019 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
10:29:50.019 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
10:29:50.019 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] A problem occurred evaluating project ':app'.
10:29:50.019 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > ASCII
10:29:50.019 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
10:29:50.019 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
10:29:50.019 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Run with --stacktrace option to get the stack trace. Run with --scan to get full insights.
10:29:50.019 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
10:29:50.019 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Get more help at https://help.gradle.org
10:29:50.019 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger]
10:29:50.019 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] BUILD FAILED in 1s
10:29:50.019 [DEBUG] [org.gradle.internal.work.DefaultWorkerLeaseService] Worker lease root.1 completed (0 worker(s) in use)
10:29:50.019 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Daemon worker: released lock on root.1
10:29:50.020 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Completing Build operation 'Run build'
10:29:50.020 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Run build' completed
10:29:50.022 [DEBUG] [org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess] Releasing file lock for cache directory md-supplier (C:\Users\Utente\.gradle\caches\4.10\md-supplier)
10:29:50.023 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on cache directory md-supplier (C:\Users\Utente\.gradle\caches\4.10\md-supplier).
10:29:50.025 [DEBUG] [org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess] Releasing file lock for cache directory md-rule (C:\Users\Utente\.gradle\caches\4.10\md-rule)
10:29:50.025 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on cache directory md-rule (C:\Users\Utente\.gradle\caches\4.10\md-rule).
10:29:50.026 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.CachedStoreFactory] Resolution result cache closed. Cache reads: 0, disk reads: 0 (avg: 0.0 secs, total: 0.0 secs)
10:29:50.027 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.CachedStoreFactory] Resolution result cache closed. Cache reads: 0, disk reads: 0 (avg: 0.0 secs, total: 0.0 secs)
10:29:50.027 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.ResolutionResultsStoreFactory] Deleted 2 resolution results binary files in 0.001 secs
10:29:50.027 [DEBUG] [org.gradle.deployment.internal.DefaultDeploymentRegistry] Stopping 0 deployment handles
10:29:50.028 [DEBUG] [org.gradle.deployment.internal.DefaultDeploymentRegistry] Stopped deployment handles
10:29:50.028 [DEBUG] [org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess] Releasing file lock for file hash cache (...\git\project\.gradle\4.10\fileHashes)
10:29:50.028 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on file hash cache (...\git\project\.gradle\4.10\fileHashes).
...
my app build.gradle
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
…
}
my build.gradle version: 3.1.1
my gradle distribution version: 4.10
How Can I solve this issue? What is the problem?
Solution 1:[1]
The problem is with the Artifactory lib version. I use this lib org.jfrog.buildinfo:build-info-extractor-gradle
and with the last version 4.9.1
, I got the problem, whereas with the 4.9.0
, all works fine.
Solution 2:[2]
I edited the android (project level) build.gradle file and changed
com.android.tools.build:gradle:3.2.1
to
com.android.tools.build:gradle:3.5.1
Solution 3:[3]
Just Follow these Steps in Android Studio
Click on the file in the menu bar
click on Project Structure
change Android Gradle plugin version to 3.5.1
sync again
Solution 4:[4]
Try to add below to your TOP LEVEL build.gradle
System.setProperty("file.encoding", "UTF-8")
Solution 5:[5]
I changed dependency at gradle.build - Project as follows:
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.google.gms:google-services:3.1.0'
}
Solution 6:[6]
Edited the android (project level) build.gradle file and changed
com.android.tools.build:gradle:3.2.1
to
com.android.tools.build:gradle:3.5.4
This solved my problem.
Solution 7:[7]
Most of these answers suggest upgrading Gradle, which is only technically correct.
Also undesired, because we noticed that Gradle-plugin versions later than 3.1.3 (i.e.
gradle-4.4-all.zip
),
require about 2 GB additional RAM (at least at time of writting, 2022).
Hence we used Git-history to find root cause (which for us at least) was using the latest Kotlin version ("1.5.30").
In other words, instead of upgrading Gradle, we did simply undo changing Kotlin version, like:
buildscript {
ext {
kotlin_version = '1.2.71'
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath('com.android.tools.build:gradle:3.1.3') {
exclude module: 'proguard-gradle'
}
classpath('net.sf.proguard:proguard-gradle:6.0') { force = true }
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Note that above uses old Gradle-plugin but overrides ProGuard with latest-version (at time of writting).
Such thing may not even be possible with new Gradle versions, because they use R8.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Zamorite |
Solution 2 | user2243481 |
Solution 3 | Shailandra Rajput |
Solution 4 | shizhen |
Solution 5 | Nico_ |
Solution 6 | Md. Al-Amin |
Solution 7 | Top-Master |