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

[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

Related

Execution failed for task ':app:checkDebugAarMetadata'. react native

PS D:\MOTOR\kawawamotorsreactapp> npx react-native run-android
warn Package react-native-vector-icons contains invalid configuration: "dependency.assets" is not allowed.
Please verify it's properly linked using "react-native config" command and contact the package maintainers
about this.
info Starting JS server...
info Installing the app...
Task :app:checkDebugAarMetadata FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings
94 actionable tasks: 41 executed, 53 up-to-date
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
The minCompileSdk (31) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-30).
Dependency: androidx.appcompat:appcompat:1.4.1.
AAR metadata file: C:\Users\BIBEK.gradle\caches\transforms-3\0e660b8bafa777eda46724d78ef391ea\transformed\appcompat-1.4.1\META-INF\com\android\build\gradle\aar-metadata.properties.
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 1m 12s
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:checkDebugAarMetadata'.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
The minCompileSdk (31) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-30).
Dependency: androidx.appcompat:appcompat:1.4.1.
AAR metadata file: C:\Users\BIBEK.gradle\caches\transforms-3\0e660b8bafa777eda46724d78ef391ea\transformed\appcompat-1.4.1\META-INF\com\android\build\gradle\aar-metadata.properties.
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 1m 12s
at makeError (D:\MOTOR\kawawamotorsreactapp\node_modules\execa\index.js:174:9)
at D:\MOTOR\kawawamotorsreactapp\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (D:\MOTOR\kawawamotorsreactapp\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (D:\MOTOR\kawawamotorsreactapp\node_modules\#react-native-community\cli\build\index.js:142:9)
info Run CLI with --verbose flag for more details.

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)

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

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

How to fix the react-native-cli Failed to install the app error?

When i run the react-native run-android i face this error.
I tried to downgrade my java version to 8 but still not working.
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 8 workers...
info JS server already running.
info Installing the app...
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings
FAILURE: Build failed with an exception.
* What went wrong:
Task 'installDebug' not found in project ':app'.
* Try:
Run gradlew tasks to get a list of available tasks. 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 3s
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:
Task 'installDebug' not found in project ':app'.
* Try:
Run gradlew tasks to get a list of available tasks. 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 3s
at makeError (D:\freelance\SuperDaily\node_modules\execa\index.js:174:9)
at D:\freelance\SuperDaily\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async runOnAllDevices (D:\freelance\SuperDaily\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
at async Command.handleAction (D:\freelance\SuperDaily\node_modules\react-native\node_modules\#react-native-community\cli\build\index.js:186:9)
I too got a similar error with this("node_modules/execa/index.js") file.
I resolved my error using the 2 commands given below
npm uninstall -g react-native-cli
yarn global add #react-native-community/cli
If my solution doesn't work then check some other solutions here
react-native run-android --variant Huaweidebug
Run with above command.
it should fixed but in case error exists then open project in android studio

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.