Does react-native support jdk 17? - javascript

So I have been having some problems with launching the initial react-native template project on android. And after consulting someone I was told that jdk 17 is not supported. But I really don't want to downgrade as this could break other things that I already have and work with. To be specific this is the error I get:
> Task :app:processDebugMainManifest FAILED
11 actionable tasks: 2 executed, 9 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module #7ec6bc9b
* 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 20s
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
* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module #7ec6bc9b
* 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 20s
at makeError (C:\Users\karti\Desktop\ShoppingList\node_modules\execa\index.js:174:9)
at C:\Users\karti\Desktop\ShoppingList\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (C:\Users\karti\Desktop\ShoppingList\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid at async Command.handleAction (C:\Users\karti\Desktop\ShoppingList\node_modules\#react-native-community\cli\build\index.js:192:9)
I have looked at this already and nothing worked.
Gradle: Execution failed for task ':processDebugManifest'

So I solved this issue by installing JDK 16 on my system and everything is solved and running fine. I don't know if the problem was with Gradle or JDK or react-native but hope that in the future jdk 17 is supported.
If you have the same issue then you can go to:
jdk 16
1)Download and Install the JDK 16.
2)Add the path to your jdk in the PATH in your system environment variable.
3)Open cmd and do java -version you should see something like
java version "16.0.2" 2021-07-20
Java(TM) SE Runtime Environment (build 16.0.2+7-67)
Java HotSpot(TM) 64-Bit Server VM (build 16.0.2+7-67, mixed mode, sharing)

To know if this is a java version-related issue, You need to check your Gradle version.
currently only Gradle version 7.3 support java 17.
You can check gradle compatibility matrix to check.
you can check your version with the command line by typing gradlew.bat -version
If your Gradle is version 7.3 then it has nothing to do with the JDK version.

Related

Can't build with expo eas build - Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information

Help needed, I'm trying to build my expo app with eas build -p android, it is showing the below "
[stderr] FAILURE: Build failed with an exception.
[stderr] * Where:
[stderr] Settings file '/home/expo/workingdir/build/android/settings.gradle' line: 3
[stderr] * What went wrong:
[stderr] A problem occurred evaluating settings 'voteboothapp'.
[stderr] > Could not read script '/home/expo/workingdir/build/node_modules/react-native-unimodules/gradle.groovy' as it does not exist.
[stderr] * Try:
[stderr] 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.
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 14s
Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.
"
I have not been stuck here for more than a week since most of the help I am seeing online are pointing me to android studio which I have followed and hence got more error trying to set up android studio, please is there anyone who can help me with ways I can build my simple expo app without having to use android studio, the classic expo build service worked flawlessly before the advent of eas-cli, the reason I have been using expo is to avoid android studio but now they are forcing devs to go back to android studio.
Edit - also I have tried expo doctor expo doctor --fix-dependencies and still not working

React Native Task :app:installDebug FAILED [duplicate]

This question already has answers here:
react-native :app:installDebug FAILED
(35 answers)
Closed 8 days ago.
i'm trying to create a new app with react native. i was using android studio emulator and now i installed genymotion. whatever when i started the app i encounted an error. react native version is 0.69.4.
> Task :app:installDebug FAILED
Skipping device 'Custom - 4.4.4' for 'app:debug': minSdkVersion [21] > deviceApiLevel [19]
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
147 actionable tasks: 2 executed, 145 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:installDebug'.
> java.util.concurrent.ExecutionException: org.gradle.api.GradleException: Failed to install on any devices.
* 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
BU?LD 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 ':app:installDebug'.
> java.util.concurrent.ExecutionException: org.gradle.api.GradleException: Failed to install on any devices.
* 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
BU?LD FAILED in 31s
at makeError (C:\Users\Egehan Berker\Desktop\poemtra\poemtra\node_modules\#react-native-community\cli-platform-android\node_modules\execa\index.js:174:9)
at C:\Users\Egehan Berker\Desktop\poemtra\poemtra\node_modules\#react-native-community\cli-platform-android\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (C:\Users\Egehan Berker\Desktop\poemtra\poemtra\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (C:\Users\Egehan Berker\Desktop\poemtra\poemtra\node_modules\#react-native-community\cli\build\index.js:192:9)
min sdk version is 21 and compileSdkVersion is 31. what should i do?
The minSdkVersion of your app is API Level 21 ( Android 5.0 ). It caused an error because you are trying to install the app on a device with API Level 19 (Andriod 4.4.4)
You can try to lower your minSdkVersion to API Level 19 (Android 4.4.4) on android/build.gradle or install your app on the emulator Android > 5.0.

React native Webview error, App not installing Help me to solve this

I am creating an app that uses webview. I installed and imported the webview and when using it, app was not installed in the android emulator. Without webview app installing correctly.
I tried by creating another project for example ,same error returns.
Here is the error by using webview:
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Build file 'F:\FirstProject\node_modules\react-native-webview\android\build.gradle' line: 35
* What went wrong:
A problem occurred evaluating project ':react-native-webview'.
> org/jetbrains/kotlin/cli/common/PropertiesKt
* 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.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':react-native-webview'.
> compileSdkVersion is not specified. Please add it to build.gradle
* 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 15s
I am using java version: java 15.0.2
compileSdkVersion : 30

How Can I run react-native app in my mobile because avd is too slow

Please help me. My React Native app is not running in my mobile. It works fine on the android simulator, but the performance is quiet bad.
The error is:
$ react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier"
flag.
Jetifier found 967 file(s) to forward-jetify. Using 2 workers...
info Starting JS server...
info Installing the app...
FAILURE: Build failed with an exception.
* What went wrong:
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
* 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 8s
error Failed to install the app. Make sure you have the Android development environment set up:
https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Com
mand failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
This might be because lower version of Jdk. Please update JDK version supported by Android Studio
For Reff : Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
Try React Native environment to upgrade your environment because there is a thread in here Grovy Error
It's simple , just connect your mobile with Android studio and on the developing mode , then select the device from Android studio and run the project the app will simply open on your phone , unless you don't have any errors in enviornment.

Problem with new version of react-native: FAILURE: Build failed with an exception

the new version of react-native (v 0.59) give me an error when trying to run that on a device or simulator:
C:\Pro\react-native jan\tictactoe>react-native run-android
info Starting JS server...
info Building and installing the app on the device (cd android && gradlew.bat app:installDebug)...
Downloading https://services.gradle.org/distributions/gradle-4.10.2-all.zip
...............................................................................................................
Unzipping C:\Users\MAN.gradle\wrapper\dists\gradle-4.10.2-all\9fahxiiecdb76a5g3aw9oi8rv\gradle-4.10.2-all.zip to C:\Users\MAN.gradle\wrapper\dists\gradle-4.10.2-all\9fahxiiecdb76a5g3aw9oi8rv
Welcome to Gradle 4.10.2!
Here are the highlights of this release:
- Incremental Java compilation by default
- Periodic Gradle caches cleanup
- Gradle Kotlin DSL 1.0-RC6
- Nested included builds
- SNAPSHOT plugin versions in the plugins {} block
For more details see https://docs.gradle.org/4.10.2/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'tictactoe'.
Could not resolve all artifacts for configuration ':classpath'.
Could not resolve com.android.tools.build:gradle:3.3.1.
Required by:
project :
Could not resolve com.android.tools.build:gradle:3.3.1.
Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.3.1/gradle-3.3.1.pom'.
Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.3.1/gradle-3.3.1.pom'.
Connect to 127.0.0.1:50002 [/127.0.0.1] failed: Connection refused: connect
Could not resolve com.android.tools.build:gradle:3.3.1.
Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.3.1/gradle-3.3.1.pom'.
Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.3.1/gradle-3.3.1.pom'.
Connect to 127.0.0.1:50002 [/127.0.0.1] failed: Connection refused: connect
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 4m 55s
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: gradlew.bat app:installDebug
what i have to do?

Categories