Execution failed for task ':app:mergeDebugResources' & Build errors - android

In every project I'm getting same following error
Information:Gradle tasks [clean, :app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources]
Error:Execution failed for task ':app:mergeDebugResources'.
Error: Some file crunching failed, see logs for details
Error:Some file crunching failed, see logs for details
Information:BUILD FAILED
Even if I'm creating new project, without adding anything I'm getting above error, also getting an
Cannot resolve symbol 'R'
in every project.

Please check any resource file is missing or not.
Otherwise go to Build in the top menu and click on Clean Project.
If this also not works then restart Android Studio.

Sometimes this error comes due to the path of the project file.
Try relocating your project with short path address and then try to build the project.

Related

Flutter returns Execution failed for task ':app:transformClassesWithDexBuilderForDebug' as soon as I add packages

I want to make an Android app with Flutter that uses the firebase ml kit to perform text recognition on images. I have successfully added firebase to my flutter project, but as soon as I add the packages image_picker: 0.6.1+4 and firebase_ml_vision: 0.9.2+1 I get the following error:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Users\mathi\.gradle\caches\transforms-1\files-1.1\firebase-analytics-impl-11.4.2.aar\266afe38e9d564b66b359ca5823523b4\jars\classes.ja
The error also occures when I add only one of the two packages.
Update build.gradle to com.android.tools.build:gradle:3.6.0 and do flutter run -v in your build in editor terminal. Because maybe you have to update your gradle-wrapper.properties too in your android folder.

Some issues while running react-native run-android

I'm facing these issues the whole day - fixing one to face another one 🤦‍♂️
what's the issue here? - after executing this command
react-native run-android?
the full error :
Task :app:compileDebugJavaWithJavac FAILED
/Users/mohsen/Desktop/roam - copy/roam/roam/android/app/src/main/java/host/exp/exponent/MainApplication.java:39: error: cannot find symbol
return BuildVariantConstants.USE_INTERNET_KERNEL;
^
symbol: variable BuildVariantConstants
location: class MainApplication
1 error
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
There might be some problem in your MainApplication.java. Look for any syntax problem or any other issue you get there. After that you can open Android studio sync your project and see if you get any error there. Update build tools from there if necessary. Maybe it will be sorted by then.

Error Execution failed for task ':app:mergeReleaseResources' building APK

After trying to build APK once and fixing an error, I got an error executing ./gradlew assembleRelease again: Execution failed for task ':app:mergeReleaseResources' building APK
The problem occured becaused when I tried to build once, it has created drawables dirs on android/app/src/main/res/. Then when I tried on second time, it has shown me this error Execution failed for task ':app:mergeReleaseResources' building APK
I just deleted the drawable-* dirs and it worked.
Hope it helps!
rm -rf android/app/src/main/res/drawable-*
As addition to accepted answer, if there is a "raw" folder in the same directory, also you must delete that.
I just deleted the drawable-* dirs as well raw dir from
android/app/src/main/res/ and it worked.
Exactly problem occurred when I tried to build once, it has created drawable dirs.
I was facing following issue:
Execution failed for task ':app:mergeReleaseResources'.
java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.3.0-5013011-windows Daemon #0: Unexpected error during compile 'E:\project\ionic\uvparentlan0.4\platforms\android\app\src\main\res\drawable-land-xxxhdpi\screen.png', attempting to stop daemon.
This should not happen under normal circumstances, please file an issue if it does.
Solution: I delete all drawable directories named "drawable-port-*****"
Now Build again " ionic cordova build --release android "
BUILD SUCCESSFUL in 1m 11s
42 actionable tasks: 40 executed, 2 up-to-date
Built the following apk(s):
Sometimes it's a result of a duplicate file. Reading the error log, it seemed that I had a duplicate file name (two files with the same name). The issue resolved by removing one of the files (from a previous build if I remember it right).
I changed .png to .jpg in drawable and it worked for me.

Proguard Error : Execution failed for task ':app:transformClassesAndResourcesWithProguardForDebug'

I am trying to build app using ProGuard in Android Studio 2.2.3 but I am getting below error :
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForDebug'.
> Job failed, see logs for details
Do you have a proguard-project.txt file in your project?
If so can you post its content? Also, you can try running 'gradle --stacktrace assemble --debug' for more details about your error.

Error:Execution failed for task ':app:packageDebug'

I get this error when trying to rebuild project after generating User Interface tests using Android Test recorder plugin for Android studio (http://droidtestlab.com/).
Every time I have to relaunch Android studio and Emulator to Get rid of this error.
Tried cleaning project then got this error,
Information:Gradle tasks [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies]
:clean
:app:clean FAILED
Error:Execution failed for task ':app:clean'.
> Unable to delete file: E:\..\AndroidStudio\..\app\build\outputs\apk\app-debug.apk
Information:BUILD FAILED
Is this a bug or what am I doing wrong here?
How can I fix this error?
Using Android studio 2.1.1 and Android 6.0, Nexus 5X API 23 emulator

Categories

Resources