I reach this step :
reactive-native run-android ;
When I run echo $JAVA_HOME, i got the full path to JDK directory :
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
I add that path to ./android/gradle.properties :
org.gradle.java.home=/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/
I got the same error which is :
..... .... :app:generateDebugSources UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE :app:compileDebugJavaWithJavac
FAILED
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:compileDebugJavaWithJavac'.
Could not find tools.jar
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
.....
This error pops up, when some plugins of react-native like masked-view unable to locate tools.jar path in your machine which exists inside JDK home lib directory.
With respect to this question, what you did is almost right but you added the Internet Plugins path which is incorrect. You have to add the jdk path of your machine.
Locate JDK path :
If your JAVA_HOME variable exists then you can find directly via terminal using
vim .zshrc or vim .bashrc command where must exists a path similar to /Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk{Your Machine JDK Version}/Contents/Home (Copy this JAVA_HOME path)
After getting path of JDK, under android folder in gradle.properties file add this line
org.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk{"REPLACE_IT_WITH_YOUR_JDK_VERSION"}/Contents/Home
Hope this will help you or somebody else!
Thanks :)
You should download JDK, finish the installation and add lib's path to PATH. In my case:
/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home/lib
It's at the same level with bin, which is:
/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home/bin
I faced same problem. My java path was wrong.
Previously i was using '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java'
I changed to '~/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java'
Now issue is solved for me.
You need to install JDK and set the JAVA_HOME pointing to your installation, example:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_311.jdk/Contents/Home
Then you need to set the Path to bin:
export PATH=$JAVA_HOME/bin:$PATH
You can find more info on below link:
https://docs.oracle.com/cd/E19182-01/821-0917/inst_jdk_javahome_t/index.html#:~:text=To%20set%20JAVA_HOME%2C%20do%20the,Program%20Files%5CJava%5Cjdk1.
Related
We created a ionic app with angular. When we use
ionic serve
Then its working fine.
But when we are generating android apk then we are getting this error:-
* Where:
Build file '/home/ankur/projects/ionicdesign/ionic-roots_v101/ionic
apps/kisansanchar/medical/platforms/android/app/build.gradle' line: 20
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not initialize class com.android.build.gradle.internal.crash.PluginCrashReporter
Here is complete log details:-
Paste Bin
Any idea about this error?
I've had the same issue.
Digging into gradle command with --scan, I've found the problem.
My ~/.android was owned by root, so my build (launch by my user) failed to read/write into this directory.
Solution: sudo chown -R you:you ~/.android
For me, it was the kotlin_version in build.gradle, the one used for building is lower than what was configured for my IDE, so what I did is deleted my .gradle caches by typing this in terminal rm -rf $HOME/.gradle/caches/
Then restarted my project in my case it was a flutter project so flutter run is the command. everything is taken care of after that.
I moved my Android SDK (and NDK) when my hard drive failed.
In my working project, I updated local.properties to reflect these changes in the variables ndk.dir and sdk.dir, yet when I run ./gradlew clean --info on the command line from within my project directory, gradle gives me a failure at the following command:
<old_ndk_path>/ndk-build NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=<oldprojdir>/app/src/main/jni/Android.mk APP_ABI=armeabi NDK_ALL_ABIS=armeabi NDK_DEBUG=1 APP_PLATFORM=android-23 NDK_OUT=<oldprojdir>/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=<oldprojdir>/app/build/intermediates/ndkBuild/debug/lib clean
It's no wonder that the task fails, since no executable exists at that path now, but how can I get gradle to make use of the new NDK path? And how can I make it use the new project directory?
Delete the <projdir>/.gradle directory and try again.
I've an error in ionic when I try to build android!
Error: Failed to find 'ANDROID_HOME' environment variable. Try setting
setting it manually. Failed to find 'android' command in your 'PATH'.
Try update your 'PATH' to include path to valid SDK directory.
but:
➜ echo $ANDROID_HOME
/home/amaitre/android-sdk-linux
and the command android work:
http://hpics.li/b1c351a
Be careful if you sudo your ionic command !
Don't forget to add the path in your super user environment :)
Download Android SDK Tools from http://developer.android.com/sdk/installing/index.html?pkg=tools
Extract in: /home/{{user}}/build/
Insert below code at ~/.profile (caution: do not remove anything from there, just append this code)
//set PATH so it includes android SDK toold
if [ -d "$HOME/build" ] ; then
ANDROID_HOME=$HOME/build/android-sdk
PATH="ANDROID_HOME/tools:$PATH"
fi
Please let me know if this suggestion solved your problem.
I have problem when building with gradle. It says that aapt doesn't exist, but aapt exists and have chmod 0777.
Code is ok, building with Ant works.
I give output:
:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':mergeDebugResources'.
> /home/nikodem/Workshop/PlanLekcji/res/drawable-mdpi/pt.png: Error: Cannot run program "/home/nikodem/Programy/AndroidSDK/build-tools/21.1.2/aapt": error=2, No such file or directory
/home/nikodem/Workshop/PlanLekcji/res/drawable-mdpi/pt.png is valid path to picture.
/home/nikodem/Programy/AndroidSDK/build-tools/21.1.2/aapt is valid path to aapt.
Just install these two packages for aapt and it'll be alright ;)
(Write these commands in your terminal window)
sudo apt-get install lib32stdc++6
sudo apt-get install lib32z1
I had the same problem. I solved it with
chmod +x /Android/Sdk/build-tools/21.1.2/aapt
After this my project built without errors.
I met this issue, so google for two hours, tried "install lib32stdc++6", but still not work, finnally, I just go to /AndroidSDK/build-tools/21.1.2/aapt, in the terminal, I use ./aapt , it popped errors like "./aapt: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory", I google and install this package and continue use ./aapt, it popped missing other packages, after install several, it finnally worked ,I think it is the final way to solve it. hope it helped
I Want to build apk using commandline, I am using ant server by using it I am building apk with commandline but when I give this command ant debug it shows error BUILD FAILED Unable to locate tools.jar and then it gives error source resource doesnt exist
This might be because your JAVA_HOME is not set to your C:\Program Files\Java\jdk folder.
instead it might be set to C:\Program Files\Java\jre so it's not getting tools.jar.
just check out this.
You can do this in this way:
C:\>set JAVA_HOME=C:\Program Files\Java\jdk
C:\>ant debug
You need tools.jar file from your jdk/lib/ folder.