Task :react-native-gradle-plugin:compileKotlin FAILED
'compileJava' task (current target is 1.8) and 'compileKotlin' task (current target is 11) jvm target compatibility should be set to the same Java version.
1 actionable task: 1 executed
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':react-native-gradle-plugin:compileKotlin'.
Failed to query the value of task ':react-native-gradle-plugin:compileKotlin' property 'compilerRunner$kotlin_gradle_plugin'.
Kotlin could not find the required JDK tools in the Java installation. Make sure Kotlin compilation is
running on a JDK, not JRE.
Try:
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 31s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':react-native-gradle-plugin:compileKotlin'.
Failed to query the value of task ':react-native-gradle-plugin:compileKotlin' property 'compilerRunner$kotlin_gradle_plugin'.
Kotlin could not find the required JDK tools in the Java installation. Make sure Kotlin compilation is
running on a JDK, not JRE.
Download and install JDK
you can check this link for more help:
https://github.com/Jire/Charlatano/issues/854
Try:
rm -rf ./node_modules
yarn
npm run android
Related
I have an exception when I write ./gradlew genSource in terminal.
* Where:
Build file 'C:\Users\Admin\Desktop\fabric-example-mod-1.19\build.gradle' line: 2
* What went wrong:
An exception occurred applying plugin request [id: 'fabric-loom', version: '0.12-SNAPSHOT']
> Failed to apply plugin 'fabric-loom'.
> You are using an outdated version of Java (8). Java 17 or higher is required.
The JAVA_HOME environment variable is currently set to (C:\Program Files\Eclipse Adoptium\jdk-8.0.332.9-hotspot\).
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
I saw my version of Java is old, but when I go to File | Settings | Build, Execution, Deployment | Build Tools | Gradle and change the Gradle JVM to ProjectSDK and try again, nothing changes.
Java 17 was downloaded and my Gradle was successfully build. Version of fabric for Minecraft is 1.19.
I am trying to setup my new project which is using JAVA16 and gradle based springboot project. But, when i am trying run it locally i have following error:
> Task :bootRun FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':bootRun'.
> Process 'command 'C:\Program Files\Java\jdk-16.0.2\bin\java.exe'' finished with non-zero exit value 1
I had verified java version also. However I tried to run from both cmd, powershell and from the terminal in Intellij.
Can some one suggest me the tip to fix it?
Can you check if you have java path set correctly? if yes, run java --version in command line and see if it points to correct version?
Also check in IntelliJ that if you have correct project SDK set. Project SDK and Project Language level should point to same version.
Try to run with --stacktrace --debug so you will get more information about the failure.
I am trying to make Minecraft mods with Fabric, but when I run ./gradlew genSources, I get this error:
FAILURE: Build failed with an exception.
* Where:
Build file '/home/andrew/Desktop/Minecraft Mods/TEST/build.gradle' line: 2
* What went wrong:
An exception occurred applying plugin request [id: 'fabric-loom', version: '0.8-SNAPSHOT']
> Failed to apply plugin 'fabric-loom'.
> You are using an outdated version of Java (11). Java 16 or higher is required.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 701ms
I uninstalled java 11 and installed java 16 with the deb file from https://www.oracle.com/java/technologies/javase-jdk16-downloads.html. Once I do that, I get this error when running ./gradlew genSources:
ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
How do I fix this? Here is the tutorial I am following: https://www.youtube.com/watch?v=_JZ7bnk3oiM
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2600Alpha1Library FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task
:app:prepareComAndroidSupportAnimatedVectorDrawable2600Alpha1Library'.
Unable to unzip
'/home/abhinavralhan/Android/Sdk/extras/android/m2repository/com/android/support/animated-vector-drawable/26.0.0-alpha1/animated-vector-drawable-26.0.0-alpha1.aar'
to
'/home/abhinavralhan/.android/build-cache/3640b9dd51da6db8e5ab286317dbd8fc702b33c2/output'
or find the cached output
'/home/abhinavralhan/.android/build-cache/3640b9dd51da6db8e5ab286317dbd8fc702b33c2/output'
using the build cache at '/home/abhinavralhan/.android/build-cache'.
To troubleshoot the issue or learn how to disable the build cache, go
to https://d.android.com/r/tools/build-cache.html. If you are unable
to fix the issue, please file a bug at
https://d.android.com/studio/report-bugs.html.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Above is the error shown in the Gradle console. Don't mark this as duplicate as none of the existing solutions work. I've tried removing cache, downloaded a new SDK but neither of the solutions seem to work. Thanks in advance. If you need build.gradle or any other source file let me know.
This solution works for Ubuntu 14.04 LTS and should work for other versions too.
Within Android Studio goto:
View>Tool Windows>Terminal
Here, run the following command:
./gradlew cleanBuildCache
After the command has executed with a BUILD SUCCESSFUL message, close Android Studio and navigate to:
<YOUR_PATH>/android-studio/bin
Here, from within the terminal, run the studio.sh script with superuser priviliges(this is important).
$ sudo bash studio.sh
That's it. Your Gradle should build successfully now.
I'm running Gradle 3.2.1 on MacOS X 10.12.1 installed with brew install gradle, did not set any env variables etc. myself, trying to use the Java 9 EA:
gradle build -Dorg.gradle.java.home=~/jdk-9.jdk/Contents/Home
But the build is failing with
FAILURE: Build failed with an exception.
What went wrong: Unable to start the daemon process. This problem might be caused by incorrect configuration of the daemon. For example,
an unrecognized jvm option is used.
From what I know it fails because the daemon is trying to use the maxpermsize JVM option (which is not supported in Java 8+ but in Java 8 it's only a warning).
So I tried to disable the daemon:
mkdir -p ~/.gradle && echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties
But gradle build is still trying to start a daemon... I removed ~/.gradle and .gradle in the project directory. Any other ideas?
$ gradle build -Dorg.gradle.daemon=false -Dorg.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home
To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/3.2.1/userguide/gradle_daemon.html.
FAILURE: Build failed with an exception.
* What went wrong:
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at https://docs.gradle.org/3.2.1/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------
FAILURE: Build failed with an exception.
* What went wrong:
java.lang.ExceptionInInitializerError (no error message)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
> Starting Daemon%
Ok so I figured it out, since I'm running my build like this:
gradle build -Dorg.gradle.java.home=~/jdk-9.jdk/Contents/Home
Gradle has to spawn a new thread to use a different Java version than the one pointed to by JAVA_HOME. This is done by spawning a daemon thread (even despite the false option) with that Java version and is failing. The same would happen if I passed JVM args to the build apparently.
The solution is to instead set JAVA_HOME in the terminal export JAVA_HOME=~/jdk-9.jdk/Contents/Home and just run gradle build.
Still doesn't work because the newest Java9 build broke Gradle's reflection but that's a different story.
I am posting this here since it's too big of a comment (but it is for sure not an answer).
If you run your script with --debug you will see the underlying error. I am running this directly via java-9 without setting the JAVA_HOME btw.
I had the same issue a few jdk-9 builds back and tackled it with:
set _JAVA_OPTIONS "-Dsun.reflect.debugModuleAccessChecks=true
--add-opens=java.base/java.lang=ALL-UNNAMED
--add-opens=java.base/java.util=ALL-UNNAMED
--add-opens=java.base/java.lang.invoke=ALL-UNNAMED
--add-opens=java.base/java.io=ALL-UNNAMED
--add-opens=java.base/java.util.concurrent=ALL-UNNAMED
--add-opens=java.base/java.text=ALL-UNNAMED"
set instead of export because I'm using fish, but should work for bash the same way.
Interestingly enough this still fails with build 153 with this:
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.Map java.util.Collections$UnmodifiableMap.m accessible: module java.base does not "opens java.util" to unnamed module #67080771
But that is specified within _JAVA_OPTIONS. This might be a regression on build 153.