Error when React Native app for the first time - react-native

info Opening the app on Android...
info JS server already running.
info Launching emulator...
info Installing the app...
> Task :react-native-gradle-plugin:compileKotlin UP-TO-DATE
.
.
.
> Task :app:createDebugApkListingFileRedirect UP-TO-DATE
> Task :app:installDebug
Installing APK 'app-debug.apk' on 'Pixel_6_API_33(AVD) - 13' for :app:debug
Installed on 1 device.
BUILD SUCCESSFUL in 10s
38 actionable tasks: 2 executed, 36 up-to-date
info Connecting to the development server...
info Starting the app...
Error: Command failed: adb shell am start -n com.app/com.app.MainActivity
at makeError (...\node_modules\#react-native-community\cli-platform-android\node_modules\execa\index.js:174:9)
at module.exports.sync (...\node_modules\#react-native-community\cli-platform-android\node_modules\execa\index.js:338:15)
at tryLaunchAppOnDevice (...\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\tryLaunchAppOnDevice.js:46:22)
at ...\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:95:39
at Array.forEach (<anonymous>)
at runOnAllDevices (...\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:90:48)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Command.handleAction (...\node_modules\#react-native-community\cli\build\index.js:108:9)
info Run CLI with --verbose flag for more details.
Any ideas on how to fix the above issue? This is a simple react native app without any additional code. Trying to run this on API 33 Android.

Related

Not Running React Native in my application

When I run "npx react-native run-android" it shows the follow message:
info JS server already running.
O sistema n�o pode encontrar o caminho especificado.
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...
ERROR: JAVA_HOME is set to an invalid directory: C:\Users\PABLO\AppData\Local\Android\Sdk
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
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
at makeError (C:\Users\PABLO\teste7\node_modules\#react-native-community\cli-platform-android\node_modules\execa\index.js:174:9)
at C:\Users\PABLO\teste7\node_modules\#react-native-community\cli-platform-android\node_modules\execa\index.js:278:16
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async runOnAllDevices (C:\Users\PABLO\teste7\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:82:7)
at async Command.handleAction (C:\Users\PABLO\teste7\node_modules\#react-native-community\cli\build\index.js:108:9)
info Run CLI with --verbose flag for more details.
I really do not know what to do to run my android emulator, once I installed conform setting up development the documentation.

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)

App build Successful but App opening gone blank

The following error messages are shown after creating a build.
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.1.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 1m 47s
315 actionable tasks: 314 executed, 1 up-to-date
info Connecting to the development server...
warn Failed to connect to development server using "adb reverse": spawnSync adb ENOENT
info Starting the app...
'adb' is not recognized as an internal or external command,
operable program or batch file.
error Failed to start the app.
Error: Command failed: adb shell am start -n com.menpani.laundry_live/com.menpani.laundry_live.MainActivity
at makeError (D:\rith_laundry\node_modules\execa\index.js:174:9)
at Function.module.exports.sync (D:\rith_laundry\node_modules\execa\index.js:338:15)
at tryLaunchAppOnDevice (D:\rith_laundry\node_modules#react-native-community\cli-platform-android\build\commands\runAndroid\tryLaunchAppOnDevice.js:58:22)
at D:\rith_laundry\node_modules#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:104:39
at Array.forEach ()
at runOnAllDevices (D:\rith_laundry\node_modules#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:102:48)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Command.handleAction (D:\rith_laundry\node_modules\react-native\node_modules#react-native-community\cli\build\index.js:186:9)
info Run CLI with --verbose flag for more details.
created the entries in system variables for JDK_HOME and PLATFORM_TOOLS, above displaying errors has been cleared, app start running on phone but still going blank,
i have something different this time, kindly check either its gradle version issue?
Result Displayed as:
Installing APK 'app-debug.apk' on 'Infinix X695 - 11' for app:debug
Installed on 1 device.
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.1.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 2m 45s
315 actionable tasks: 314 executed, 1 up-to-date
info Connecting to the development server...
info Starting the app on "067682514L109008"...
Starting: Intent { cmp=com.menpani.laundry_live/.MainActivity }

My React-Native application cannot start in emulator

My React-Native application cannot start in emulator.
help please!
c:\src\a1>npx react-native run-android
warn Package some-unsupported-package has been ignored because it contains invalid configuration. Reason: Cannot find module 'some-unsupported-package\package.json'
Require stack:
- c:\src\a1\node_modules\react-native\node_modules#react-native-community\cli\build\tools\config\resolveNodeModuleDir.js
- c:\src\a1\node_modules\react-native\node_modules#react-native-community\cli\build\tools\releaseChecker\index.js
- c:\src\a1\node_modules\react-native\node_modules#react-native-community\cli\build\commands\server\runServer.js
- c:\src\a1\node_modules\react-native\node_modules#react-native-community\cli\build\commands\server\server.js
- c:\src\a1\node_modules\react-native\node_modules#react-native-community\cli\build\commands\index.js
- c:\src\a1\node_modules\react-native\node_modules#react-native-community\cli\build\index.js
- c:\src\a1\node_modules\react-native\cli.js
error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually:
- react-native-gesture-handler (to unlink run: "react-native unlink react-native-gesture-handler")
This is likely happening when upgrading React Native from below 0.60 to 0.60 or above. Going forward, you can unlink this dependency via "react-native unlink " and it will be included in your app automatically. If a library isn't compatible with autolinking, disregard this message and notify the library maintainers.
Read more about autolinking: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1010 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
* daemon not running; starting now at tcp:5037
* daemon started successfully
info Launching emulator...
info Successfully launched emulator.
info Installing the app...
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
Task :app:generateDebugBuildConfig FAILED
18 actionable tasks: 2 executed, 16 up-to-date
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:generateDebugBuildConfig'.
org.xml.sax.SAXParseException; systemId: file:/C:/src/a1/android/app/src/main/AndroidManifest.xml; lineNumber: 9; columnNumber: 40; The prefix "tools" for attribute "tools:node" associated with an element type "uses-permission" is not bound.
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 35s
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:generateDebugBuildConfig'.
org.xml.sax.SAXParseException; systemId: file:/C:/src/a1/android/app/src/main/AndroidManifest.xml; lineNumber: 9; columnNumber: 40; The prefix "tools" for attribute "tools:node" associated with an element type "uses-permission" is not bound.
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 35s
at checkExecSyncError (child_process.js:630:11)
at execFileSync (child_process.js:648:15)
at runOnAllDevices (c:\src\a1\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Command.handleAction (c:\src\a1\node_modules\react-native\node_modules\#react-native-community\cli\build\index.js:182:9)

Error while executing npx react-native run-android

I am new to React native and trying to connect my android device but it is showing the following error. I have probably made some mistakes during installation. What should I do so that the emulator will start?
C:\Users\Bhavna>cd AwesomeProject
C:\Users\Bhavna\AwesomeProject>npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 864 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
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...
> Task :app:installDebug FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.5/userguide/command_line_interface.html#sec:command_line_warnings
27 actionable tasks: 2 executed, 25 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No connected 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
BUILD FAILED in 6s
error Failed to install the app. Make sure you have an Android emulator running or a device connected. 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:installDebug'.
> com.android.builder.testing.api.DeviceException: No connected 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
BUILD FAILED in 6s
at checkExecSyncError (child_process.js:621:11)
at execFileSync (child_process.js:639:15)
at runOnAllDevices (C:\Users\Bhavna\AwesomeProject\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
You should connect a physical device or launch simulator from android studio, before running
react-native run-android
> com.android.builder.testing.api.DeviceException: No connected devices!
You should check if you enable the debug mode in your phone.
And follow this.
export PATH=~/Library/Android/sdk/tools:$PATH
export PATH=~/Library/Android/sdk/platform-tools:$PATH
adb reverse tcp:8081 tcp:8081
adb shell input keyevent 82
The first one enables adb in your terminal.
And the second onen enables 8081 port.
If you run the third one then you could see the developer menu in your app.
I tried changing option from 'charging this device' to 'transfer files' and now it's working fine. Thank you everyone!
I've got this issue. Here's my solution: the path to platform-tools in the environment variable must be in PATH and not in ANDROID_HOME!