Error spawnsync adb enoent

I Had Setup Android Studio installed in Mac I had installed ADB Nexus 6p (R and Android Pie) Tried Manually Running Android Emulator - Works Perfect AVD Manager: Nexus 6p with Android R and Android...

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.

Already on GitHub?
Sign in
to your account


Closed

iOSDevGarg opened this issue

Apr 21, 2020

· 30 comments

Comments

@iOSDevGarg

  1. I Had Setup Android Studio installed in Mac
  2. I had installed ADB Nexus 6p (R and Android Pie)
  3. Tried Manually Running Android Emulator — Works Perfect

AVD Manager:

Nexus 6p with Android R and Android Pie

Screen Shot 2020-04-21 at 8 59 59 PM
Installed SDK:

Screen Shot 2020-04-21 at 8 59 39 PM

SDK Platforms

Screen Shot 2020-04-21 at 8 59 44 PM

bash_profile or bashrc

Command Used: nano .bash_profile

export ANDROID_HOME=/Users/user/Library/Android/sdk
export PATH=${PATH}:/Users/user/Library/Android/sdk/tools
export PATH=${PATH}:/Users/user/Library/Android/sdk/platform-tools
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools

Command used: npx @react-native-community/cli doctor

user@Devs-Mac MyReactApp % npx @react-native-community/cli doctor
Common
 ✓ Node.js
 ✓ yarn
 ✓ Watchman - Used for watching changes in the filesystem when in development mode

Android
 ✓ JDK
 ✖ ANDROID_HOME
 ✖ Android SDK - Required for building and installing your app on Android
   - Versions found: N/A
   - Version supported: 28.0.3

iOS
 ✓ Xcode - Required for building and installing your app on iOS
 ✓ CocoaPods - Required for installing iOS dependencies
 ✓ ios-deploy - Required for installing your app on a physical device with the CLI

Command used: npx react-native run-android

user@Devs-Mac MyReactApp % npx 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 8 workers...
info Starting JS server...
/bin/sh: adb: command not found
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 748ms

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew 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 748ms

    at makeError (/Users/user/Desktop/sa/MyReactApp/node_modules/execa/index.js:174:9)
    at /Users/user/Desktop/sa/MyReactApp/node_modules/execa/index.js:278:16
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async runOnAllDevices (/Users/user/Desktop/sa/MyReactApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:5)
    at async Command.handleAction (/Users/user/Desktop/sa/MyReactApp/node_modules/@react-native-community/cli/build/index.js:186:9)

File local.properties inside android folder of React-native project

## This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Tue Apr 21 17:57:13 IST 2020
sdk.dir=/Users/user/Library/Android/sdk

Command: react-native info Environment Information

user@Devs-Mac MyReactApp % react-native info
info Fetching system and libraries information...
System:
    OS: macOS 10.15.4
    CPU: (8) x64 Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz
    Memory: 8.14 GB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 13.13.0 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.4 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK: Not Found
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6308749
    Xcode: 11.4/11E146 - /usr/bin/xcodebuild
  Languages:
    Java: 14.0.1 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.11.0 => 16.11.0 
    react-native: 0.62.2 => 0.62.2 
  npmGlobalPackages:
    *react-native*: Not Found

Even ran brew cask install android-sdk Just to make it work
Logs Below

user@Devs-Mac ~ % brew cask install android-sdk
Updating Homebrew...
==> Caveats
You can control android sdk packages via the sdkmanager command.
You may want to add to your profile:

  'export ANDROID_SDK_ROOT="/usr/local/share/android-sdk"'

android-sdk requires Java 8. You can install it with:
  brew cask install homebrew/cask-versions/adoptopenjdk8

==> Downloading https://dl.google.com/android/repository/sdk-tools-darwin-4333796.zip
######################################################################## 100.0%
==> Verifying SHA-256 checksum for Cask 'android-sdk'.
==> Installing Cask android-sdk
==> Linking Binary 'android' to '/usr/local/bin/android'.
==> Linking Binary 'archquery' to '/usr/local/bin/archquery'.
==> Linking Binary 'avdmanager' to '/usr/local/bin/avdmanager'.
==> Linking Binary 'jobb' to '/usr/local/bin/jobb'.
==> Linking Binary 'lint' to '/usr/local/bin/lint'.
==> Linking Binary 'monkeyrunner' to '/usr/local/bin/monkeyrunner'.
==> Linking Binary 'screenshot2' to '/usr/local/bin/screenshot2'.
==> Linking Binary 'sdkmanager' to '/usr/local/bin/sdkmanager'.
==> Linking Binary 'uiautomatorviewer' to '/usr/local/bin/uiautomatorviewer'.
==> Linking Binary 'emulator' to '/usr/local/bin/emulator'.
==> Linking Binary 'emulator-check' to '/usr/local/bin/emulator-check'.
==> Linking Binary 'mksdcard' to '/usr/local/bin/mksdcard'.
==> Linking Binary 'monitor' to '/usr/local/bin/monitor'.
🍺  android-sdk was successfully installed!

Issue Still same

@github-actions

⚠️ Missing Environment Information
ℹ️ Your issue may be missing information about your development environment. You can obtain the missing information by running react-native info in a console.

@iOSDevGarg

⚠️ Missing Environment Information
ℹ️ Your issue may be missing information about your development environment. You can obtain the missing information by running react-native info in a console.

Hi I have updated Question with Environment Information. It says Android SDK missing. But I have already installed it

@sunguoxing0628

@RockinGarg i hope it helps you

1、open a terminal
2、touch ~/.bash_profile
3、open ~/.bash_profile
4、write

export ANDROID_HOME=/Users/yourname/Library/Android/sdk
export PATH=$ANDROID_HOME/tools:$PATH
export PATH=$ANDROID_HOME/platform-tools:$PATH

5、source ~/.bash_profile(if it doesn’t work,next)
6、change "android": "react-native run-android" to "android": "source ~/.bash_profile&&react-native run-android", and run yarn android

image

image

Tobim99, carlosalvarez91, SavageWilliam, RoohAlmahaba, Omar-He, milanumeshchalishajarwala12, ilya-raevskiy, Renan04lima, KrialY, icreatevisions, and 15 more reacted with thumbs up emoji
Tobim99, SavageWilliam, mani3710, Omar-He, ilya-raevskiy, Renan04lima, adamako, natasha08n, celalyuksel, m4tr1k, and 6 more reacted with hooray emoji
Tobim99, yoojinkimm, ubaidmoin, ilya-raevskiy, Renan04lima, Doipah, natasha08n, m4tr1k, nicholasrussellweb, lee-vathanaka, and 5 more reacted with heart emoji
dhananjay2011 reacted with rocket emoji

@jwd2a

Can confirm this bug. Started a new project last night and ran up against this. Tried again, and tried @sunguoxing0628’s suggestions, but still getting this:

image

Environment details:

  • MacOS 10.15.3
  • ZShell
  • react-native-cli: 2.0.1
  • react-native: 0.61.5
  • Android Debug Bridge version 1.0.41
  • java 14.0.1 2020-04-14
  • Gradle 6.3

And just in case the react-native info output is helpful:

System:
    OS: macOS 10.15.3
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 177.10 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node
    Yarn: 1.17.3 - /usr/local/bin/yarn
    npm: 6.9.0 - ~/.nvm/versions/node/v10.16.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6392135
    Xcode: 11.4.1/11E503a - /usr/bin/xcodebuild
  npmPackages:
    react: ~16.9.0 => 16.9.0 
    react-native: ~0.61.5 => 0.61.5 
  npmGlobalPackages:
    create-react-native-app: 2.0.2
    react-native-cli: 2.0.1

edit: updated env details

@sunguoxing0628

@jwd2a
Before that, I used Android Studio to install the gradle and run the app. I don’t know if it has any impact.

@iOSDevGarg

@iOSDevGarg

For now I used Android Studio to Build App once. But it is still issue that it doesn’t work with command Line

@sunguoxing0628

my environment information.

$ source ~/.bash_profile&&react-native info

info Fetching system and libraries information...
System:
    OS: macOS 10.15.4
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
    Memory: 1.89 GB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.16.2 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.4 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK:
      Android NDK: 21.0.6113669
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6392135
    Xcode: 11.4.1/11E503a - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.6 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.11.0 => 16.11.0 
    react-native: 0.62.2 => 0.62.2 
  npmGlobalPackages:
    *react-native*: Not Found

$ source ~/.bash_profile&&npx @react-native-community/cli doctor

Common
 ✓ Node.js
 ✓ yarn
 ✓ Watchman - Used for watching changes in the filesystem when in development mode

Android
 ✓ JDK
 ✓ ANDROID_HOME
 ✖ Android SDK - Required for building and installing your app on Android
   - Versions found: N/A
   - Version supported: 28.0.3

iOS
 ✓ Xcode - Required for building and installing your app on iOS
 ✓ CocoaPods - Required for installing iOS dependencies
 ✓ ios-deploy - Required for installing your app on a physical device with the CLI

$ source ~/.bash_profile&&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 8 workers...
info Starting JS server...
info Launching emulator...
info Successfully launched emulator.
info Installing the app...
Starting a Gradle Daemon (subsequent builds will be faster)

> Task :app:installDebug
Installing APK 'app-debug.apk' on 'Pixel_2_API_21(AVD) - 5.0.2' for app:debug
Installed on 1 device.

BUILD SUCCESSFUL in 16s
26 actionable tasks: 2 executed, 24 up-to-date
info Connecting to the development server...
info Starting the app on "emulator-5554"...
Starting: Intent { cmp=com.egos_app/.MainActivity }
✨  Done in 24.42s.

@gokhandoslu

Hi,

  • Shell: 5.7.1 — /bin/zsh
    Your shell is zsh, not bash. Therefore you need to source your .bash_profile in zshrc file.
    Just add the line below into ~/.zshrc
    source ~/.bash_profile
    Then restart your terminal or source your ~/.zshrc by using the code below
    source ~/.zshrc
    To check adb:
    adb --version

  • error Failed to launch emulator. Reason: No emulators found as an output of emulator -list-avds.
    Open Android Studio AVD Manager, then create an emulator if you have no emulators.
    If you have emulators, then wipe their data and rerun
    npx react-native run-android

@iOSDevGarg

Hi All
Attaching info again It says Android SDK: Not Found which looks like the main reason that it not letting me launch Emulator from react-native command
But I had already installed Android SDK and Android Studio Too

user@Devs-Mac MyReactApp % react-native info
info Fetching system and libraries information...
System:
    OS: macOS 10.15.4
    CPU: (8) x64 Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz
    Memory: 11.32 GB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 13.13.0 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.4 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    **Android SDK: Not Found**
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6308749
    Xcode: 11.4/11E146 - /usr/bin/xcodebuild
  Languages:
    Java: 14.0.1 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.11.0 => 16.11.0 
    react-native: 0.62.2 => 0.62.2 
  npmGlobalPackages:
    *react-native*: Not Found

@chrisglein

If I’m understanding correctly this works when running directly but not from the CLI? Did the last set of tips about your bash config help? Have you been able to get react-native doctor to run clean? Is that still giving the same failures?

@iOSDevGarg

Hi yes you are right
I am to run in android through android studio
But not through CLI

Bash changes i made as suggested none worked

React-native doctor says
AndroidSDK: not found
But its installed

@developius

This is happening for me too. It was all working fine yesterday, I could run my RN app on both iOS and Android.
Today however, I’m getting this error from Android when using npx react-native run-android:

java.lang.RuntimeException: Unable to instantiate application <my identifier>.MainApplication: java.lang.ClassNotFoundException: Didn't find class "<my identifier>.MainApplication"

Doing npx react-native doctor gives:

 ✓ Node.js
 ✓ yarn
 ✓ Watchman - Used for watching changes in the filesystem when in development mode

Android
 ✓ ANDROID_HOME
 ✖ Android SDK - Required for building and installing your app on Android
   - Versions found: N/A
   - Version supported: 28.0.3

iOS
 ✓ Xcode - Required for building and installing your app on iOS
 ✓ CocoaPods - Required for installing iOS dependencies
 ✓ ios-deploy - Required for installing your app on a physical device with the CLI

I followed the installation instructions to the T, and it was all working correctly yesterday. That suggests to me there’s something up with the environment variables but I can’t work out what it is. Here’s my .bash_profile:

export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools

Running source ~/.bash_profile && npx react-native doctor gives the same output as above.

@developius

Update: running this appears to fix the issue. No idea why.

cd android && ./gradlew clean

@iOSDevGarg

Hi @developius

that seems helped me with previous error
now I get below log

user@Devs-Mac MyReactApp % npx react-native run-android                 
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 990 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
/bin/sh: adb: command not found
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 :react-native-webview:compileDebugJavaWithJavac

> Task :app:compileDebugJavaWithJavac

> Task :app:stripDebugDebugSymbols
WARNING: Compatible side by side NDK version was not found. Default is 20.0.5594570.
Compatible side by side NDK version was not found. Default is 20.0.5594570.
Unable to strip the following libraries, packaging them as they are: libc++_shared.so, libc++_shared.so, libc++_shared.so, libc++_shared.so, libevent-2.1.so, libevent-2.1.so, libevent-2.1.so, libevent-2.1.so, libevent_core-2.1.so, libevent_core-2.1.so, libevent_core-2.1.so, libevent_core-2.1.so, libevent_extra-2.1.so, libevent_extra-2.1.so, libevent_extra-2.1.so, libevent_extra-2.1.so, libfb.so, libfb.so, libfb.so, libfb.so, libfbjni.so, libfbjni.so, libfbjni.so, libfbjni.so, libflipper.so, libflipper.so, libflipper.so, libflipper.so, libfolly_futures.so, libfolly_futures.so, libfolly_futures.so, libfolly_futures.so, libfolly_json.so, libfolly_json.so, libfolly_json.so, libfolly_json.so, libglog.so, libglog.so, libglog.so, libglog.so, libglog_init.so, libglog_init.so, libglog_init.so, libglog_init.so, libhermes-executor-debug.so, libhermes-executor-debug.so, libhermes-executor-debug.so, libhermes-executor-debug.so, libhermes-executor-release.so, libhermes-executor-release.so, libhermes-executor-release.so, libhermes-executor-release.so, libhermes-inspector.so, libhermes-inspector.so, libhermes-inspector.so, libhermes-inspector.so, libimagepipeline.so, libimagepipeline.so, libimagepipeline.so, libimagepipeline.so, libjsc.so, libjsc.so, libjsc.so, libjsc.so, libjscexecutor.so, libjscexecutor.so, libjscexecutor.so, libjscexecutor.so, libjsijniprofiler.so, libjsijniprofiler.so, libjsijniprofiler.so, libjsijniprofiler.so, libjsinspector.so, libjsinspector.so, libjsinspector.so, libjsinspector.so, libnative-filters.so, libnative-filters.so, libnative-filters.so, libnative-filters.so, libnative-imagetranscoder.so, libnative-imagetranscoder.so, libnative-imagetranscoder.so, libnative-imagetranscoder.so, libreactnativeblob.so, libreactnativeblob.so, libreactnativeblob.so, libreactnativeblob.so, libreactnativejni.so, libreactnativejni.so, libreactnativejni.so, libreactnativejni.so, libyoga.so, libyoga.so, libyoga.so, libyoga.so.

> Task :app:installDebug
Installing APK 'app-debug.apk' on 'Nexus_6P_Edited_API_R(AVD) - 10' 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.3/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 24s
47 actionable tasks: 47 executed
info Connecting to the development server...
warn Failed to connect to development server using "adb reverse": spawnSync adb ENOENT
info Starting the app...
error Failed to start the app. Run CLI with --verbose flag for more details.
Error: spawnSync adb ENOENT
    at Object.spawnSync (internal/child_process.js:1045:20)
    at Object.spawnSync (child_process.js:597:24)
    at Function.module.exports.sync (/Users/user/Desktop/sa/MyReactApp/node_modules/execa/index.js:334:30)
    at tryLaunchAppOnDevice (/Users/user/Desktop/sa/MyReactApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/tryLaunchAppOnDevice.js:57:22)
    at /Users/user/Desktop/sa/MyReactApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:104:39
    at Array.forEach (<anonymous>)
    at runOnAllDevices (/Users/user/Desktop/sa/MyReactApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:102:48)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Command.handleAction (/Users/user/Desktop/sa/MyReactApp/node_modules/react-native/node_modules/@react-native-community/cli/build/index.js:186:9)

@Liqiankun

@chrisglein

@RockinGarg There were plenty of errors/warnings in that log to follow up on. Did you end up getting unblocked?

@iOSDevGarg

Hi I used Android Studio to manually install Build on Android Emulator then manually launch the App by running server.

I am still unable to use
react-native run-android (Doesn’t Work)
whereas
react-native run-is (Works Perfect)

@mylesshie

Hi @developius

that seems helped me with previous error
now I get below log

user@Devs-Mac MyReactApp % npx react-native run-android                 
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 990 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
/bin/sh: adb: command not found
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 :react-native-webview:compileDebugJavaWithJavac

> Task :app:compileDebugJavaWithJavac

> Task :app:stripDebugDebugSymbols
WARNING: Compatible side by side NDK version was not found. Default is 20.0.5594570.
Compatible side by side NDK version was not found. Default is 20.0.5594570.
Unable to strip the following libraries, packaging them as they are: libc++_shared.so, libc++_shared.so, libc++_shared.so, libc++_shared.so, libevent-2.1.so, libevent-2.1.so, libevent-2.1.so, libevent-2.1.so, libevent_core-2.1.so, libevent_core-2.1.so, libevent_core-2.1.so, libevent_core-2.1.so, libevent_extra-2.1.so, libevent_extra-2.1.so, libevent_extra-2.1.so, libevent_extra-2.1.so, libfb.so, libfb.so, libfb.so, libfb.so, libfbjni.so, libfbjni.so, libfbjni.so, libfbjni.so, libflipper.so, libflipper.so, libflipper.so, libflipper.so, libfolly_futures.so, libfolly_futures.so, libfolly_futures.so, libfolly_futures.so, libfolly_json.so, libfolly_json.so, libfolly_json.so, libfolly_json.so, libglog.so, libglog.so, libglog.so, libglog.so, libglog_init.so, libglog_init.so, libglog_init.so, libglog_init.so, libhermes-executor-debug.so, libhermes-executor-debug.so, libhermes-executor-debug.so, libhermes-executor-debug.so, libhermes-executor-release.so, libhermes-executor-release.so, libhermes-executor-release.so, libhermes-executor-release.so, libhermes-inspector.so, libhermes-inspector.so, libhermes-inspector.so, libhermes-inspector.so, libimagepipeline.so, libimagepipeline.so, libimagepipeline.so, libimagepipeline.so, libjsc.so, libjsc.so, libjsc.so, libjsc.so, libjscexecutor.so, libjscexecutor.so, libjscexecutor.so, libjscexecutor.so, libjsijniprofiler.so, libjsijniprofiler.so, libjsijniprofiler.so, libjsijniprofiler.so, libjsinspector.so, libjsinspector.so, libjsinspector.so, libjsinspector.so, libnative-filters.so, libnative-filters.so, libnative-filters.so, libnative-filters.so, libnative-imagetranscoder.so, libnative-imagetranscoder.so, libnative-imagetranscoder.so, libnative-imagetranscoder.so, libreactnativeblob.so, libreactnativeblob.so, libreactnativeblob.so, libreactnativeblob.so, libreactnativejni.so, libreactnativejni.so, libreactnativejni.so, libreactnativejni.so, libyoga.so, libyoga.so, libyoga.so, libyoga.so.

> Task :app:installDebug
Installing APK 'app-debug.apk' on 'Nexus_6P_Edited_API_R(AVD) - 10' 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.3/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 24s
47 actionable tasks: 47 executed
info Connecting to the development server...
warn Failed to connect to development server using "adb reverse": spawnSync adb ENOENT
info Starting the app...
error Failed to start the app. Run CLI with --verbose flag for more details.
Error: spawnSync adb ENOENT
    at Object.spawnSync (internal/child_process.js:1045:20)
    at Object.spawnSync (child_process.js:597:24)
    at Function.module.exports.sync (/Users/user/Desktop/sa/MyReactApp/node_modules/execa/index.js:334:30)
    at tryLaunchAppOnDevice (/Users/user/Desktop/sa/MyReactApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/tryLaunchAppOnDevice.js:57:22)
    at /Users/user/Desktop/sa/MyReactApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:104:39
    at Array.forEach (<anonymous>)
    at runOnAllDevices (/Users/user/Desktop/sa/MyReactApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:102:48)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Command.handleAction (/Users/user/Desktop/sa/MyReactApp/node_modules/react-native/node_modules/@react-native-community/cli/build/index.js:186:9)

I have the same error with you, so I launch the app in Android Studio, It work well。

@Mhde96

Hi @developius

that seems helped me with previous error
now I get below log

user@Devs-Mac MyReactApp % npx react-native run-android                 
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 990 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
/bin/sh: adb: command not found
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 :react-native-webview:compileDebugJavaWithJavac

> Task :app:compileDebugJavaWithJavac

> Task :app:stripDebugDebugSymbols
WARNING: Compatible side by side NDK version was not found. Default is 20.0.5594570.
Compatible side by side NDK version was not found. Default is 20.0.5594570.
Unable to strip the following libraries, packaging them as they are: libc++_shared.so, libc++_shared.so, libc++_shared.so, libc++_shared.so, libevent-2.1.so, libevent-2.1.so, libevent-2.1.so, libevent-2.1.so, libevent_core-2.1.so, libevent_core-2.1.so, libevent_core-2.1.so, libevent_core-2.1.so, libevent_extra-2.1.so, libevent_extra-2.1.so, libevent_extra-2.1.so, libevent_extra-2.1.so, libfb.so, libfb.so, libfb.so, libfb.so, libfbjni.so, libfbjni.so, libfbjni.so, libfbjni.so, libflipper.so, libflipper.so, libflipper.so, libflipper.so, libfolly_futures.so, libfolly_futures.so, libfolly_futures.so, libfolly_futures.so, libfolly_json.so, libfolly_json.so, libfolly_json.so, libfolly_json.so, libglog.so, libglog.so, libglog.so, libglog.so, libglog_init.so, libglog_init.so, libglog_init.so, libglog_init.so, libhermes-executor-debug.so, libhermes-executor-debug.so, libhermes-executor-debug.so, libhermes-executor-debug.so, libhermes-executor-release.so, libhermes-executor-release.so, libhermes-executor-release.so, libhermes-executor-release.so, libhermes-inspector.so, libhermes-inspector.so, libhermes-inspector.so, libhermes-inspector.so, libimagepipeline.so, libimagepipeline.so, libimagepipeline.so, libimagepipeline.so, libjsc.so, libjsc.so, libjsc.so, libjsc.so, libjscexecutor.so, libjscexecutor.so, libjscexecutor.so, libjscexecutor.so, libjsijniprofiler.so, libjsijniprofiler.so, libjsijniprofiler.so, libjsijniprofiler.so, libjsinspector.so, libjsinspector.so, libjsinspector.so, libjsinspector.so, libnative-filters.so, libnative-filters.so, libnative-filters.so, libnative-filters.so, libnative-imagetranscoder.so, libnative-imagetranscoder.so, libnative-imagetranscoder.so, libnative-imagetranscoder.so, libreactnativeblob.so, libreactnativeblob.so, libreactnativeblob.so, libreactnativeblob.so, libreactnativejni.so, libreactnativejni.so, libreactnativejni.so, libreactnativejni.so, libyoga.so, libyoga.so, libyoga.so, libyoga.so.

> Task :app:installDebug
Installing APK 'app-debug.apk' on 'Nexus_6P_Edited_API_R(AVD) - 10' 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.3/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 24s
47 actionable tasks: 47 executed
info Connecting to the development server...
warn Failed to connect to development server using "adb reverse": spawnSync adb ENOENT
info Starting the app...
error Failed to start the app. Run CLI with --verbose flag for more details.
Error: spawnSync adb ENOENT
    at Object.spawnSync (internal/child_process.js:1045:20)
    at Object.spawnSync (child_process.js:597:24)
    at Function.module.exports.sync (/Users/user/Desktop/sa/MyReactApp/node_modules/execa/index.js:334:30)
    at tryLaunchAppOnDevice (/Users/user/Desktop/sa/MyReactApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/tryLaunchAppOnDevice.js:57:22)
    at /Users/user/Desktop/sa/MyReactApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:104:39
    at Array.forEach (<anonymous>)
    at runOnAllDevices (/Users/user/Desktop/sa/MyReactApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:102:48)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Command.handleAction (/Users/user/Desktop/sa/MyReactApp/node_modules/react-native/node_modules/@react-native-community/cli/build/index.js:186:9)

what are you doing here for be like this
i have the same initial issues

@developius

@Mhde96 @mylesshie @RockinGarg

Your logs include a message about missing adb (/bin/sh: adb: command not found). I would suggest making sure adb is installed before trying to debug anything else. Also, react-native doctor is your friend.

@esfxra

Hello, I am experiencing a similar issue in my macOS + Android Studio setup when running react-native run-android from the command line.

The only way I can get it to work is by building the project from Android Studio. Also:

  • I tried ./gradlew clean in the ./android folder but that alone fails as well.

  • I have checked my .zshrc setup a few times. I even hardcoded $ANDROID_HOME to the path found in Android Studio’s settings.

This is occurring with the 0.63.3 release. Could someone please advise?

This is the error:

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 448ms

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 app:installDebug -PreactNativeDevServerPort=8081

And the info from react-native info:

System:
    OS: macOS 10.15.7
    CPU: (8) x64 Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz
    Memory: 1.64 GB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 14.13.0 - ~/.nvm/versions/node/v14.13.0/bin/node
    Yarn: 1.22.5 - /usr/local/bin/yarn
    npm: 6.14.8 - ~/.nvm/versions/node/v14.13.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.0, DriverKit 19.0, macOS 10.15, tvOS 14.0, watchOS 7.0
    Android SDK:
      API Levels: 29
      Build Tools: 28.0.3, 29.0.2, 30.0.2
      System Images: android-29 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.6858069
    Xcode: 12.0.1/12A7300 - /usr/bin/xcodebuild
  Languages:
    Java: javac 15 - /usr/bin/javac
    Python: 3.8.3 - /Users/diegoserrano/.pyenv/shims/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: 0.63.3 => 0.63.3 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

The result of running react-native doctor:

Common
 ✓ Node.js
 ✓ yarn
 ✓ Watchman - Used for watching changes in the filesystem when in development mode

Android
 ✓ JDK
 ✓ Android Studio - Required for building and installing your app on Android
 ✓ Android SDK - Required for building and installing your app on Android
 ✓ ANDROID_HOME

iOS
 ✓ Xcode - Required for building and installing your app on iOS
 ✓ CocoaPods - Required for installing iOS dependencies
 ● ios-deploy - Required for installing your app on a physical device with the CLI

Errors:   0
Warnings: 1

@gideondev

I am facing the same issue.
Wow, this is open for a long time.

@esfxra

Setting up a $JAVA_HOME variable to point to the adoptopenjdk11 I installed through homebrew helped with this issue.
In my case, it seemed like a past JRE/JDK installation was interfering. I can also run gradlew commands now.

Would be helpful to mention adding $JAVA_HOME in the docs.

@iOSDevGarg

Setting up a $JAVA_HOME variable to point to the adoptopenjdk11 I installed through homebrew helped with this issue.
In my case, it seemed like a past JRE/JDK installation was interfering. I can also run gradlew commands now.

Would be helpful to mention adding $JAVA_HOME in the docs.

Hi can you share your full bash_profile or where have you set java_home variable

@esfxra

@RockinGarg I use zsh. This is my .zshrc configuration for react-native:

export JAVA_HOME_8=$(/usr/libexec/java_home -v1.8)
export JAVA_HOME_11=$(/usr/libexec/java_home -v11)
export JAVA_HOME=$JAVA_HOME_11

export ANDROID_HOME=/Users/diegoserrano/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools

@campsjos

In my case I had to install Android SDK Command-line Tools (in SDK Manager > SDK Tools) in order to react-native doctor recognise Android SDK

@sakkaras

@iOSDevGarg

I would like to close this issue
It’s been long i am working on react native and found this command fails sometimes and sometimes that’s work it’s intermittent.
If app is already installed then this command works fine else it fails

If anyone think this issue is occurring feel free to open

My observation
Call
source ~./bash_profile before you run
react-native run-android command

This makes it works sometimes

@junedkhan

Update: running this appears to fix the issue. No idea why.

cd android && ./gradlew clean

Thanks @developius this has sloved my issues.

@facebook
facebook

locked as resolved and limited conversation to collaborators

Nov 17, 2021

Failed to start the app. Error: spawnSync adb ENOENT #32116

Comments

LumiProj commented Aug 30, 2021 •

I am using Mac latest version.

On Android I am getting this error.

/bin/sh: adb: command not found
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.
Starting a Gradle Daemon (subsequent builds will be faster)

Task :app:installDebug
Installing APK ‘app-debug.apk’ on ‘SM-A022F — 10’ for app:debug
Installed on 1 device.

BUILD SUCCESSFUL in 25s
31 actionable tasks: 2 executed, 29 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.
error Failed to start the app.
Error: spawnSync adb ENOENT
at Object.spawnSync (internal/child_process.js:1074:20)
at Object.spawnSync (child_process.js:746:24)
at Function.module.exports.sync (/Users/impro/Desktop/testapp/MyApp/node_modules/execa/index.js:334:30)
at tryLaunchAppOnDevice (/Users/impro/Desktop/testapp/MyApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/tryLaunchAppOnDevice.js:58:22)
at /Users/impro/Desktop/testapp/MyApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:116:39
at Array.forEach ()
at runOnAllDevices (/Users/impro/Desktop/testapp/MyApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:114:48)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Command.handleAction (/Users/impro/Desktop/testapp/MyApp/node_modules/react-native/node_modules/@react-native-community/cli/build/index.js:186:9)
info Run CLI with —verbose flag for more details.
impro@atifs-mbp myapp %

React Native version:

System:
OS: macOS 11.5.2
CPU: (8) x64 Apple M1
Memory: 17.84 MB / 8.00 GB
Shell: 5.8 — /bin/zsh
Binaries:
Node: 14.17.5 — /usr/local/bin/node
Yarn: Not Found
npm: 6.14.14 — /usr/local/bin/npm
Watchman: Not Found
Managers:
CocoaPods: 1.10.2 — /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Xcode: 12.5.1/12E507 — /usr/bin/xcodebuild
Languages:
Java: 11.0.12 — /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.65.1 => 0.65.1
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps To Reproduce

Getting error when I debug app using React Cli
npx react-native run-android

Expected Results

App run in device in debug mode.

The text was updated successfully, but these errors were encountered:

Источник

Почему не запускается приложение с react-native-cli в android studio?

BUILD SUCCESSFUL in 35s
50 actionable tasks: 2 executed, 48 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.
error Failed to start the app.
Error: spawnSync adb ENOENT
at Object.spawnSync (node:internal/child_process:1111:20)
at Object.spawnSync (node:child_process:814:24)
at Function.module.exports.sync (/Users/nicole/VI/node_modules/execa/index.js:334:30)
at tryLaunchAppOnDevice (/Users/nicole/VI/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/tryLaunchAppOnDevice.js:58:22)
at /Users/nicole/VI/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:119:39
at Array.forEach ()
at runOnAllDevices (/Users/nicole/VI/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:117:48)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Command.handleAction (/Users/nicole/VI/node_modules/@react-native-community/cli/build/index.js:192:9)
info Run CLI with —verbose flag for more details.

warn Failed to connect to development server using «adb reverse»: spawnSync adb ENOENT

даже не ошибка а так
Но потом все вылетает к чертям

А вот переменные

Источник

npx react-native run-android not working #28480

Comments

mgoral2 commented Apr 1, 2020 •

Hi. I am trying to work on an open source project (https://github.com/zulip/zulip-mobile) but when I download the code and run «npx react-native run-android» I get the following error:

I am trying to run on android virtual device. Here is my «npx react-native info» command output:

Thanks for your help!

The text was updated successfully, but these errors were encountered:

mgoral2 commented Apr 1, 2020

Hi. I got the same error when I created a blank project with «npx react-native init project» and tried to run it.

AhmedHalim96 commented Apr 3, 2020

I have the same issue with blank projects too and didn’t find any useful answer

caesar3x commented Apr 3, 2020

Make sure you have an Android emulator running or a device connected and have

That is the point. Did you start Android emulator or connect your phone?

github-actions bot commented Apr 3, 2020

⚠️ Missing Required Fields
ℹ️ It looks like your issue may be missing some necessary information. GitHub provides an example template whenever a new issue is created. Could you go back and make sure to fill out the template? You may edit this issue, or close it and open a new one.

github-actions bot commented Apr 3, 2020

⚠️ Missing Reproducible Example
ℹ️ It looks like your issue is missing a reproducible example. Please provide a Snack or a repository that demonstrates the issue you are reporting in a minimal, complete, and reproducible manner.

github-actions bot commented Apr 3, 2020

⚠️ Using Old Version
ℹ️ It looks like you are using an older version of React Native. Please upgrade to the latest version, and verify if the issue persists. If it does not, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the current release.

mgoral2 commented Apr 4, 2020

HI. Can someone please help me with this or provide details as to what I need to do next? I am confused about the directions.

AhmedHalim96 commented Apr 8, 2020 •

Warning: What I did below is nonsense
The problem for me is that I had a faulty build tools so I deleted it and the setup script just downloaded it again and everything worked just fine

Here is what worked for me:

  1. install Android NDK from Android Studio SDK manager.
    that might work on its own but for me it throws a new error something like «property ‘splitSelectExe’ does not exist.»
  2. add this code to the end of «build.gradle» located in «your_app_folder/android/»
    subprojects < afterEvaluate if (project.hasProperty(«android»)) < android < compileSdkVersion 28 buildToolsVersion ‘29.0.0’ buildTypes < releaseStaging <>> > > > >

this just change build tools version God knows why I should do that. I’m on Linux btw I don’t know if this will work on Windows or mac.

overwatchh commented Apr 15, 2020

Hi. I got the same error when I created a blank project with «npx react-native init project» and tried to run it.

Here is what worked for me:
1.Make sure you turn on Developer mode on your emulator/phone by going to setting->systemInfo->buildNumber
Mutiple click on buildnumber to turn on developer mode ( same as real phone)
2. Ad the following the YourProject/android/local.properties
Note:if local.properties file is not exist create it by the command «touch YourProject/android/local.properties»
sdk.dir = «

/Android/Sdk»
3.Run react-native start
4.Run reac-native run-android
Hope it help.

PiPauwels commented Jun 7, 2020

@mgoral2 Did you finally get this to work? I’m having the exact same issue. Strange thing is, opening the project in Android Studio and running it directly from there works just fine, whereas running it from command line doesn’t.

PiPauwels commented Jun 11, 2020 •

After some digging, I found out that the problem must indeed be somewhere in the setup script. This is how I managed to get it up & running (using npx react-native run-android ). After creating a new project with npx react-native init AwesomeProject (as documented in React Native docs), I

  1. created a folder «assets» in AwesomeProjectandroidappsrcmain
  2. ran this command in AwesomeProject :

npx react-native bundle —platform android —dev false —entry-file index.js —bundle-output android/app/src/main/assets/index.android.bundle —assets-des android/app/src/main/res

  1. opened the file AwesomeProjectandroidgradlewrappergradle-wrapper.properties
  2. changed the gradle version in the distributionUrl property into: gradle-6.3-all.zip
  3. ran this command in AwesomeProjectandroid :

After that I was able to run the project using npx react-native run-android without any problems. So to my knowledge, there is a bug somewhere in the setup.

PiPauwels commented Jun 11, 2020 •

@hramos I see that you added «Needs Repro» & «Verify on latest version» ; the steps to reproduce this bug are very simple: follow the setup instructions (on a Windows 10 machine). I tried this multiple times on the current version:

  1. npx react-native init AwesomeProject
  2. cd AwesomeProject
  3. npx react-native start
  4. npx react-native run-android

Using the steps in my previous comment resolves this issue.

safaiyeh commented Aug 7, 2020

Hi @PiPauwels & @mgoral2
Could you run npx react-native doctor on your project’s root to identify problems with your environment?

stale bot commented Dec 26, 2020

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community’s attention? This issue may be closed if no further activity occurs. You may also label this issue as a «Discussion» or add it to the «Backlog» and I will leave it open. Thank you for your contributions.

narumolp commented Feb 6, 2021 •

After some digging, I found out that the problem must indeed be somewhere in the setup script. This is how I managed to get it up & running (using npx react-native run-android ). After creating a new project with npx react-native init AwesomeProject (as documented in React Native docs), I

  1. created a folder «assets» in AwesomeProjectandroidappsrcmain
  2. ran this command in AwesomeProject :

npx react-native bundle —platform android —dev false —entry-file index.js —bundle-output android/app/src/main/assets/index.android.bundle —assets-des android/app/src/main/res

  1. opened the file AwesomeProjectandroidgradlewrappergradle-wrapper.properties
  2. changed the gradle version in the distributionUrl property into: gradle-6.3-all.zip
  3. ran this command in AwesomeProjectandroid :

After that I was able to run the project using npx react-native run-android without any problems. So to my knowledge, there is a bug somewhere in the setup.

Thank you for the above answer. It’s very useful,
There is one typo, change, —assets-des to —assets-dest
After I follow your step, the android still has the same issue below. So I had to run the Emulator from the Android Studio.

Источник

When I execute react native run Android, I report an error #30169

Comments

zhengxuanyi commented Oct 14, 2020

Please provide all the information requested. Issues that do not follow this format are likely to stall.

Description

Please provide a clear and concise description of what the bug is. Include screenshots if needed.
Please test using the latest React Native release to make sure your issue has not already been fixed: https://reactnative.dev/docs/upgrading.html

React Native version:

Run react-native info in your terminal and copy the results here.

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

Operating environment
node: v14.13.1
Yarn :1.22.10
npm :6.14.8
Watchman:4.9.0
ruby:ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
gem:3.0.3
pod :1.9.3
cocoapods:1.9.3
java version «1.8.0_191»
«react»: «16.13.1»,
«react-native»: «0.63.3»
error:

27 actionable tasks: 2 executed, 25 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.
error Failed to start the app. Run CLI with —verbose flag for more details.
Error: spawnSync adb ENOENT
at Object.spawnSync (internal/child_process.js:1066:20)

There are problems in running the real machine and the simulator, I hope you can help me

Expected Results

Describe what you expected to happen.

Snack, code example, screenshot, or link to a repository:

Please provide a Snack (https://snack.expo.io/), a link to a repository on GitHub, or provide a minimal code example that reproduces the problem.
You may provide a screenshot of the application if you think it is relevant to your bug report.
Here are some tips for providing a minimal example: https://stackoverflow.com/help/mcve

The text was updated successfully, but these errors were encountered:

Источник

1. Error: Activity class {com.appname/com.appname.MainActivity} does not exist.

Despite the message, this is in fact not an error. As long as you got the successful green message “BUILD SUCCESSFUL” (see image below), you can manually open the app on the device/emulator on which you built the project. Just find the app icon and tap on it. That will open the app.

Error: Activity class does not exist

2. No bundle URL present

If you’re getting this error, it means your packager server didn’t start. You’ll have to start it manually by running

npm start -- --reset-cache

Once the metro bundler started, simply reload the project.

3. Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain

If you’re running into this issue, it’s because you’re missing this file: android/gradle/wrapper/gradle-wrapper.jar .

You can generate this binary by simply running

gradle wrapper

in the project’s android folder. If you don’t have gradle installed, follow gradle documentation on how to install it (or just run “brew install gradle” on MacOS).

4. SDK Location not found

If you’re running into this issue when building a React Native mobile app on Android, it’s because your Android SDK path is broken or it doesn’t exist. Open your ~/.bash_profile, and add the following lines at the beginning:

export ANDROID_HOME=~/Library/Android/sdk/
export PATH=~/Library/Android/sdk/tools:$PATH
export PATH=~/Library/Android/sdk/platform-tools:$PATH

Now load the new ~/.bash_profile in your Terminal (restart the Terminal or run “source ~/.bash_profile“), and re-run the Android app.

5. App gets stuck on the splash screen

If you are able to successfully build the project, but the app stays blocked on the splash screen (also known as the launch screen), this usually means you didn’t start the metro bundler in the correct folder or under the right React Native version.

To start the metro bundler in the correct folder, please make sure you locate the project folder in the Terminal and run

npm start -- --reset-cache

This is usually enough to fix the error. Reload the app and see if it works. If it’s still not working, then do a full wipe out by running:

watchman watch-del-all && rm -f yarn.lock && rm -rf node_modules && yarn && yarn start -- --reset-cache

Once the metro bundler started, you can simply re-build the project again (in Xcode for iOS, or react-native run-android for Android), and you’ll see the packager loading the JS code as follows:

metro bundler

6. Keystore file ‘…android/app/debug.keystore’ not found for signing config ‘debug’.

You can fix this error by simply running the following command in your android/app folder and typing in all the requested information:

keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000

7. No known class method for selector “credentialWithProviderID”…

Click on the error, and change the line 1184 from

credential = [FIROAuthProvider credentialWithProviderID:@"apple.com" IDToken:authToken rawNonce:authTokenSecret];

to

credential = [FIROAuthProvider credentialWithProviderID:@"apple.com" IDToken:authToken accessToken:authTokenSecret];

Now re-run the Xcode project and you’ll notice the error went away.

8. warn Failed to connect to development server using “adb reverse”: spawnSync adb ENOENT

This is just an warning, and it means the build was successful, but it couldn’t open the app. Check out the app on your emulator / android device, and simply open it manually.

9. React Native Version Mismatch

This usually means that you opened the metro bundler in a different project. In 99% of the cases, running the following command in the correct folder will fix the error:

npm start -- --reset-cache

If this doesn’t work, try running

react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res

and rebuild the project.

You can also try running

adb reverse tcp:8081 tcp:8081

which sometimes helps too.

If nothing worked, try restarting your computer.

10. Error: Firestore: Operation was rejected because the system is not in a state required for the operation`s execution. (firestore/failed-precondition)”

This error shows up when first running our apps that have more complex performance improvements.

You need to create the proper indices in your Firestore tables, used for loading data much faster. We do console.log these errors, so simply look into the console for a custom Firebase URL that looks like this (“The query requires an index. You can create it here: “):

Clicking on that URL will automatically land you in the Firebase UI for creating that index:

Simply click the “Create Index” button, and wait for the index to be created before running your app again. You’ll notice the error will disappear as soon as the index is created.

Alternatively, you can also create the index manually, in the Firebase Console UI (Firestore -> Indexes)

    Table of contents

  • Failed to connect to development server using «adb reverse»
  • React Native Errors

Find the data you need here

We provide programming data of 20 most popular languages, hope to help you!

Previous PostNext Post

Failed to connect to development server using «adb reverse»

$ adb reconnect
$ adb reverse tcp:8081 tcp:8081
        > Task :app:installDebug
    Installing APK 'app-debug.apk' on 'SM-N770F - 10' 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.3/userguide/command_line_interface.html#sec:command_line_warnings
    
    BUILD SUCCESSFUL in 2m 17s
    227 actionable tasks: 227 executed
    info Connecting to the development server...
    warn Failed to connect to development server using "adb reverse": spawnSync adb ENOENT
    info Starting the app...
    error Failed to start the app. Run CLI with --verbose flag for more details.

React Native Errors

npm start -- --reset-cache
gradle wrapper
export ANDROID_HOME=~/Library/Android/sdk/
export PATH=~/Library/Android/sdk/tools:$PATH
export PATH=~/Library/Android/sdk/platform-tools:$PATH
npm start -- --reset-cache
watchman watch-del-all && rm -f yarn.lock && rm -rf node_modules && yarn && yarn start -- --reset-cache
keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000
credential = [FIROAuthProvider credentialWithProviderID:@"apple.com" IDToken:authToken rawNonce:authTokenSecret];
credential = [FIROAuthProvider credentialWithProviderID:@"apple.com" IDToken:authToken accessToken:authTokenSecret];
npm start -- --reset-cache
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
adb reverse tcp:8081 tcp:8081

Previous PostNext Post

Понравилась статья? Поделить с друзьями:
  • Error spawn run exe sirus
  • Error spawn node enoent
  • Error setting certificate verify locations visual studio
  • Error spawn ffmpeg enoent
  • Error setting certificate verify locations cafile etc pki tls certs ca bundle crt capath none