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

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

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.

Instruct gradle to use local files

I am trying to build an ionic 4 project for android with this command:
ionic cordova build android --verbose
The bulid fails with the following error:
Running command: /path/gradlew cdvBuildDebug -b /path/build.gradle
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find com.android.tools.build:gradle:3.3.0.
Searched in the following locations:
- https://dl.google.com/path/gradle-3.3.0.pom
- https://dl.google.com/path/gradle-3.3.0.jar
...
When I do wget https://dl.google.com/path/gradle-3.3.0.pom I get 404.
When I paste the url into the addressbar of my browser however the file does get downloaded. So, I have been able to download the files gradle is having trouble downloading.
Is there a way I instruct gradle to use the local files instead of trying to download them?
i think this is for sanctions and if we can use vpn thats resolved

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

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

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.

Cannot run any project in Android Studio 0.8.1

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.

Categories

Resources