I Can't running for android development react native, but it no problem on ios development, I'm using mac M1 Chip - react-native

I've done everything according to the documentation instructions but I'm having problems running for android, please help, its been 1 day I'm tray to fixed this, this the error message in my console,
thank you all
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 863 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Installing the app...
> 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 #3376ca5d
* 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
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 app:installDebug -PreactNativeDevServerPort=8081
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 #3376ca5d
* 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
at makeError (/Users/riswangp/Documents/AwesomeProject/node_modules/execa/index.js:174:9)
at /Users/riswangp/Documents/AwesomeProject/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/Users/riswangp/Documents/AwesomeProject/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
at async Command.handleAction (/Users/riswangp/Documents/AwesomeProject/node_modules/#react-native-community/cli/build/index.js:192:9)
info Run CLI with --verbose flag for more details.
enter image description here
this screenshot the errors

Related

pls am using linux mint , we ever i tried to run react native app , it gives me this error

Pls if anyone have a solution to why i can't run react native app on linux mint 20.3
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 863 file(s) to forward-jetify. Using 4 workers...
info Starting JS server...
info Installing the app...
debug Running command "cd android && ./gradlew app:installDebug -PreactNativeDevServerPort=8081"
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 #197a83d6
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 7s
at makeError (/home/habibu/Documents/Dev/React_Native_Dev/Test_Dev/AwesomeProject/node_modules/execa/index.js:174:9)
at /home/habibu/Documents/Dev/React_Native_Dev/Test_Dev/AwesomeProject/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/home/habibu/Documents/Dev/React_Native_Dev/Test_Dev/AwesomeProject/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
at async Command.handleAction (/home/habibu/Documents/Dev/React_Native_Dev/Test_Dev/AwesomeProject/node_modules/#react-native-community/cli/build/index.js:192:9)

Facing this issue when I try to run app on my mobile device

[C:\Users\Riaz\AwesomeProject>npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 896 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
info Installing the app...
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
Task :app:compileDebugJavaWithJavac
Task :app:compileDebugJavaWithJavac FAILED
15 actionable tasks: 2 executed, 13 up-to-date
Note: C:\Users\Riaz\AwesomeProject\android\app\src\debug\java\com\awesomeproject\ReactNativeFlipper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
java.lang.IllegalAccessError: class org.gradle.internal.compiler.java.ClassNameCollector (in unnamed module #0x1741397c) cannot access class com.sun.tools.javac.code.Symbol$TypeSymbol (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.code to unnamed module #0x1741397c
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 19s
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
Note: C:\Users\Riaz\AwesomeProject\android\app\src\debug\java\com\awesomeproject\ReactNativeFlipper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
java.lang.IllegalAccessError: class org.gradle.internal.compiler.java.ClassNameCollector (in unnamed module #0x1741397c) cannot access class com.sun.tools.javac.code.Symbol$TypeSymbol (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.code to unnamed module #0x1741397c
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 19s
at makeError (C:\Users\Riaz\AwesomeProject\node_modules\execa\index.js:174:9)
at C:\Users\Riaz\AwesomeProject\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async runOnAllDevices (C:\Users\Riaz\AwesomeProject\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
at async Command.handleAction (C:\Users\Riaz\AwesomeProject\node_modules\react-native\node_modules\#react-native-community\cli\build\index.js:186:9)
info Run CLI with --verbose flag for more details.]1
Try replacing
"script":{
"start": "react-native run-android"
}
with
"script":{
"start": "npx jetify && cd android && ./gradlew clean && cd .. && react-native run-android"
}
in package.json
then run
npm run start
or
yarn start

React-Native error when starting Android studio Task :app:compileDebugJavaWithJavac FAILED

I am new to App Development and React-native, I am trying to start the Emulator for Android studio using 'npx react-native run-android' in VS Code, No matter what I do I always get the Following error:
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :app:compileDebugJavaWithJavac FAILED
15 actionable tasks: 2 executed, 13 up-to-date
Note: C:\Users\User\Testing\android\app\src\debug\java\com\testing\ReactNativeFlipper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> java.lang.IllegalAccessError: class org.gradle.internal.compiler.java.ClassNameCollector (in unnamed module #0x247a2315) cannot access class com.sun.tools.javac.code.Symbol$TypeSymbol (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.code to unnamed module #0x247a2315
* 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
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
Note: C:\Users\User\Testing\android\app\src\debug\java\com\testing\ReactNativeFlipper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> java.lang.IllegalAccessError: class org.gradle.internal.compiler.java.ClassNameCollector (in unnamed module #0x247a2315) cannot access class com.sun.tools.javac.code.Symbol$TypeSymbol (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.code to unnamed module #0x247a2315
* 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
at makeError (C:\Users\User\Testing\node_modules\execa\index.js:174:9)
at C:\Users\User\Testing\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async runOnAllDevices (C:\Users\User\Testing\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
at async Command.handleAction (C:\Users\User\Testing\node_modules\#react-native-community\cli\build\index.js:186:9)
info Run CLI with --verbose flag for more details.
This is my build.gradle file:
buildToolsVersion = "29.0.3"
minSdkVersion = 21
compileSdkVersion = 29
targetSdkVersion = 29
ndkVersion = "20.1.5948944"
I am genuinely stuck at this point any help would be greatly appreciated
The problem was I had the latest version of the JDK (jdk-16.0.1) installed which was causing errors, by downgrading (to jdk-15.0.2) and updating my system variables again that solved the problem for me.

react-native run-android i have isssu how to solve?

C:\Users\Sumithra K\Desktop\s\AwesomeProject>npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 960 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
'C:\Users\Sumithra' is not recognized as an internal or external command,
operable program or batch file.
info Launching emulator...
error Failed to launch emulator. Reason: No emulators found as an output of emulator -list-avds.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
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 16s
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: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
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 16s
at makeError (C:\Users\Sumithra K\Desktop\s\AwesomeProject\node_modules\execa\index.js:174:9)
at C:\Users\Sumithra K\Desktop\s\AwesomeProject\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async runOnAllDevices (C:\Users\Sumithra K\Desktop\s\AwesomeProject\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
at async Command.handleAction (C:\Users\Sumithra K\Desktop\s\AwesomeProject\node_modules\react-native\node_modules\#react-native-community\cli\build\index.js:186:9)
C:\Users\Sumithra K\Desktop\s\AwesomeProject>npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 960 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
'C:\Users\Sumithra' is not recognized as an internal or external command,
operable program or batch file.
info Launching emulator...
error Failed to launch emulator. Reason: No emulators found as an output of emulator -list-avds.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
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 2s
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: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
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 2s
at makeError (C:\Users\Sumithra K\Desktop\s\AwesomeProject\node_modules\execa\index.js:174:9)
at C:\Users\Sumithra K\Desktop\s\AwesomeProject\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async runOnAllDevices (C:\Users\Sumithra K\Desktop\s\AwesomeProject\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
at async Command.handleAction (C:\Users\Sumithra K\Desktop\s\AwesomeProject\node_modules\react-native\node_modules\#react-native-community\cli\build\index.js:186:9)
It says there is no emulator running to launch the application.
use adb devices command to see if there is any emulator or mobile devices attached.
Let me know if you still need help.

React Native can't build APK file

I have successfully build react-native app folder according to this http://facebook.github.io/react-native/docs/getting-started documentation
But, when I am running react-native run-android in cmd, it is showing me this -
info Starting JS server...
info Installing the app...
> Task :app:mergeDebugResources FAILED
9 actionable tasks: 8 executed, 1 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Specified AAPT2 executable does not exist: C:\Users\DE\.gradle\caches\transforms-2\files-2.1\e3571e1615ccf7c32524cbf1a8ed0eb8\aapt2-3.4.1-5326820-windows\aapt2.exe
* 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 55s
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Specified AAPT2 executable does not exist: C:\Users\DE\.gradle\caches\transforms-2\files-2.1\e3571e1615ccf7c32524cbf1a8ed0eb8\aapt2-3.4.1-5326820-windows\aapt2.exe
* 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 55s
at checkExecSyncError (child_process.js:621:11)
at execFileSync (child_process.js:639:15)
at runOnAllDevices (C:\Users\DE\AwesomeApp\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:75:39)
at buildAndRun (C:\Users\DE\AwesomeApp\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:137:41)
at C:\Users\DE\AwesomeApp\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:103:12
at processTicksAndRejections (internal/process/task_queues.js:89:5)
at async Command.handleAction (C:\Users\DE\AwesomeApp\node_modules\#react-native-community\cli\build\cliEntry.js:160:7)```
I have resolved this problem by deleting the cache of .gradle folder. The path is C:\Users\DE\.gradle\caches . After that, apps are building.
I had the same problem. I tried going to the application directory the second one with cmd and running "react-native start". This solved my problem.