how fix Execution failed for task ':react-native-smart-splashscreen:verifyReleaseResources' - android

I use react-native-smart-splash-screen and install completely (do all task in docs).
and its work in the android emulator.
i install gradle-4-10-2 and in ./android folder in my project run this command $> ./gradlew assembleRelease
but get this erors:
What went wrong:
Execution failed for task ':react-native-smart-splashscreen:verifyReleaseResources'.
com.android.ide.common.process.ProcessException: Failed to execute aapt
I use the react-native link but also not work
how can fix it and build .apk file

Firstly, ensure Generated Signed APK . If error still exists, try add this line in your project gradle.properties file:
android.enableAapt2=false

Related

React-native android: gradle clean fails

I'm using react native to develop an android app. When I run the command
./gradlew clean
I get these errors:
> Task :app:clean FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:clean'.
> java.io.IOException: Unable to delete directory '/Users/XXXXXX/APPNAME/android/app/build'
Failed to delete some children. This might happen because a process has files open or has its working directory set in the target directory.
And the directories it points to are all variations on this: android/app/build/intermediates/merged_res_blame_folder/debug/out/*
Some things I've tried:
changing ownership of the files/folders
ending all java processes from Activity Monitor
ending Daemons with ./gradlew --stop
Not sure what I'm doing wrong. For what it's worth I've followed all the steps outlined in https://reactnative.dev/docs/environment-setup.
I managed to solve the issue by manually deleting the /android/app/build folder and rerunning ./gradlew clean. For some reason I could not delete it from the command line so I had to use the file explorer gui.

Gradle fails with: Failed to load compiled script from classpath [.../.gradle/caches/jars-9/.../classes.jar]

After trying cleaning up the build cache (doing 'rm -rf $HOME/.gradle/caches/' as suggested in How to clear gradle cache?), Gradle stopped working entirely (no task would work). All of them immediate report the following error:
* Where:
Settings file '/.../android/settings.gradle.kts' line: 1
* What went wrong:
Failed to load compiled script from classpath [/.../.gradle/caches/jars-9/.../classes.jar].
Any ideas?
I found that the whole $HOME/.gradle folder needed to be deleted, otherwise Gradle would not work, looking for a missing jar. So, the solution:
rm -rf $HOME/.gradle

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.

Error:Execution failed for task ':react-native-fbads:processDebugResources'. > com.android.ide.common.process.ProcessException: Failed to execute aapt

After I clone from gitlab a react-native project
npm install
react-native run-android
add --stacktrace
But I do have build tool 23.0.1. How can I fix it?
ADB configuration may be missing
MyComputer-Properties-Advances System Settings-System Properties-Environment Variable - User variable
here add path to tool inside android SDK
pathto SDK/platform-tools
In the screenshot when you ran with --stacktrace you can actually see the error:
Cannot run program: "/home/ljh/work/software/Sdk/build-tools/23.0.1/aapt"
and then the error in Chinese saying:
"No file or directory"
Make sure the file /home/ljh/work/software/Sdk/build-tools/23.0.1/aapt actually exists, or if it does, try to execute it by hand form that directory ("$ aapt package -h") to see if an anti-virus isn't blocking it.

Android Studio multi-dex gradle doesn't recognize java on mac

I'm trying to compile a gradle project (plugin 0.14.0) with multi-dex on my Mac, and getting this error:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':ApplicationContainer:createDebugMainDexClassList'.
> java.io.IOException: Cannot run program "java": error=2, No such file or directory
Any suggestions?
When I execute ./gradlew from terminal, it works.
Found a solution.
Seems like Android Studio didn't inherit environment path or something.
I ran it from the terminal:
open /Applications/Android\ Studio.app
And it solved it.
More elegant solutions will be happily accepted :D

Categories

Resources