'Android Studio says FAILURE: Build failed with an exception after updating to 3.6.2
All my codes was running fine. But When I updated the android studio to 3.6.2 it show:
Executing tasks: [:app:assembleDebug] in project /home/AK_47/AndroidStudioProjects/MyProject
> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :app:generateDebugBuildConfig UP-TO-DATE
> Task :app:javaPreCompileDebug UP-TO-DATE
> Task :app:compileDebugRenderscript NO-SOURCE
> Task :app:compileDebugAidl NO-SOURCE
> Task :app:mainApkListPersistenceDebug UP-TO-DATE
> Task :app:generateDebugResValues UP-TO-DATE
> Task :app:generateDebugResources UP-TO-DATE
> Task :app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Could not resolve all files for configuration ':app:_internal_aapt2_binary'.
> Could not resolve com.android.tools.build:aapt2:3.6.2-6040484.
Required by:
project :app
> No cached version of com.android.tools.build:aapt2:3.6.2-6040484 available for offline mode.
> No cached version of com.android.tools.build:aapt2:3.6.2-6040484 available for offline mode.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
5 actionable tasks: 1 executed, 4 up-to-date
I was trying to make an ANDROID application. But after updating it isn't working. Any solution?
Solution 1:[1]
Try to turn off Gradle Offline mode from Gradle tool located at right side of Android Studio. then please follow below steps:
Run following command to clear gradle cache:
rm -rf ~/.gradle/caches/
after that please click on Invalidate Caches/Restart from File menu then further processing will happen which dowloads all the libraries again so it takes time but also resolves this issue.
Solution 2:[2]
At Gradle I used
rm -rf ~/.gradle/
Then gradle clean build
And ./gradlew test
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 | Jaimil Patel |
| Solution 2 | Diogo Santos |
