I cannot run any project. I created a default project with an acitivity and when i try to run it I get this error.
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\androidstudio\sdk\build-tools\android-4.4W\dx.bat --dex --num-threads=4 --output C:\projects\app\build\intermediates\dex\debug C:\projects\app\build\intermediates\classes\debug C:\projects\app\build\intermediates\dependency-cache\debug
Error Code:
1
Output:
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
any dependency it tries to copy to dex/debug im guessing, but fails to do so.
Any ideas?
First of all, you should double check that the path C:\androidstudio\sdk\build-tools\android-4.4W\dx.bat does indeed exist. It could be that your SDK configuration is pointing at an invalid directory (though that's unlikely, given how far you're getting in the compilation/build process).
After that, this looks very similar to a similar error on OSX, so you might try the proposed solution there, which is to run gradlew.bat --stop using the Gradle wrapper script that should be in the root of your project and then try to compile again.
Related
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.
At first install running a program all is normal. And then it's happened since I add a splash screen in there. I've reinstalled the application but nothing was changed. First run normal and the second run is failed again. I try to check my gradle and the file, but no one problem that found in there.
How I can fix this problem?
Execution failed for task ':app:mergeDebugResources'.
Could not resolve all files for configuration ':app:_internal_aapt2_binary'.
Failed to transform aapt2-4.1.2-6503028-windows.jar (com.android.tools.build:aapt2:4.1.2-6503028) to match attributes {artifactType=_internal-android-aapt2-binary, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for Aapt2Extractor: C:\Users\ASUS.gradle\caches\modules-2\files-2.1\com.android.tools.build\aapt2\4.1.2-6503028\6d9042942daa27a40e3ff66254cb2a82a7f0b69f\aapt2-4.1.2-6503028-windows.jar.
> Failed to create directory 'C:\Users\ASUS.gradle\caches\transforms-2\files-2.1\0acdb043263d98cb86ad08d6f4b1bd1a\aapt2-4.1.2-6503028-windows'
Cannot isolate the issue but you can try these things if the caches got scrambled or something
try clean build or invalidate caches/restart
If the above didn't work delete the build/caches folder and rerun. From what I can see you can go here C:\Users\ASUS.gradle\caches and delete the caches folder, this will most certainly resolve your issue.
If that also didn't work the ultimate resort would be nuking the caches
Close Android Studio
open terminal and go to project location (cd project location)
./gradlew clean
./gradlew --stop
rm -rf ~/.gradle/caches
./gradlew assembleDebug
Open Android Studio and gradle sync
I hope it works.
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
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.
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