Как запустить приложение react native без подобных проблем?

#android #react-native #android-studio #adb

Вопрос:

Как я могу решить эту проблему?

 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 8 workers... info Starting JS server... /bin/sh: 1: /home/muhammed/Android/Sdk/platform-tools/adb: Permission denied info Launching emulator... /bin/sh: 1: /home/muhammed/Android/Sdk/platform-tools/adb: Permission denied /bin/sh: 1: /home/muhammed/Android/Sdk/platform-tools/adb: Permission denied /bin/sh: 1: /home/muhammed/Android/Sdk/platform-tools/adb: Permission denied /bin/sh: 1: /home/muhammed/Android/Sdk/platform-tools/adb: Permission denied error Failed to launch emulator. Reason: Emulator exited before boot.. warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch. info Installing the app...
    
   
Task :app:compileDebugJavaWithJavac

Task :app:stripDebugDebugSymbols Unable to strip the following libraries, packaging them as they are: libc  _shared.so, libevent-2.1.so, libevent_core-2.1.so, libevent_extra-2.1.so, libfb.so, libfbjni.so, libflipper.so, libfolly_futures.so, libfolly_json.so, libglog.so, libglog_init.so, libhermes-executor-common-debug.so, libhermes-executor-common-release.so, libhermes-executor-debug.so, libhermes-executor-release.so, libhermes-inspector.so, libimagepipeline.so, libjsc.so, libjscexecutor.so, libjsijniprofiler.so, libjsinspector.so, libnative-filters.so, libnative-imagetranscoder.so, libreact_codegen_reactandroidspec.so, libreact_nativemodule_core.so, libreactnativeblob.so, libreactnativejni.so, libreactnativeutilsjni.so, libreactperfloggerjni.so, libturbomodulejsijni.so, libyoga.so.

Task :app:installDebug FAILED 29 actionable tasks: 29 executed Note: /home/muhammed/Desktop/intro/android/app/src/debug/java/com/intro/ReactNativeFlipper.java uses or overrides a deprecated API. Note: Recompile with
-Xlint:deprecation for details. [adb]: Cannot run program "/home/muhammed/Android/Sdk/platform-tools/adb": error=13, Permission denied

FAILURE: Build failed with an exception.

* What went wrong: Execution failed for task ':app:installDebug'.
java.io.IOException: Cannot run program "/home/muhammed/Android/Sdk/platform-tools/adb": error=13, Permission denied

* 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 4s

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 Note: /home/muhammed/Desktop/intro/android/app/src/debug/java/com/intro/ReactNativeFlipper.java uses or overrides a deprecated API. Note: Recompile with
-Xlint:deprecation for details. [adb]: Cannot run program "/home/muhammed/Android/Sdk/platform-tools/adb": error=13, Permission denied

FAILURE: Build failed with an exception.

* What went wrong: Execution failed for task ':app:installDebug'.
> java.io.IOException: Cannot run program "/home/muhammed/Android/Sdk/platform-tools/adb": error=13, Permission denied

* 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 4s

    at makeError (/home/muhammed/Desktop/intro/node_modules/execa/index.js:174:9)
    at /home/muhammed/Desktop/intro/node_modules/execa/index.js:278:16
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async runOnAllDevices (/home/muhammed/Desktop/intro/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:5)
    at async Command.handleAction (/home/muhammed/Desktop/intro/node_modules/@react-native-community/cli/build/index.js:186:9) info Run CLI with --verbose flag for more details.
 

Ответ №1:

Такого рода ошибки обычно возникали из-за неправильной конфигурации среды.

Повторите проверку, следуя официальным документам:

https://reactnative.dev/docs/environment-setup

Обычно в системе отсутствует переменная среды.

Комментарии:

1. Попробуйте запустить его с помощью sudo, похоже, проблема с разрешениями.