如何在没有任何此类问题的情况下运行本机应用程序?
Posted
技术标签:
【中文标题】如何在没有任何此类问题的情况下运行本机应用程序?【英文标题】:How to run react native app without any problems like these? 【发布时间】:2021-09-14 22:38:49 【问题描述】:我该如何解决这些问题?
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
通常是系统上缺少环境变量。
【讨论】:
尝试用sudo运行,好像是权限问题。以上是关于如何在没有任何此类问题的情况下运行本机应用程序?的主要内容,如果未能解决你的问题,请参考以下文章
如何解决此错误:ENOENT:没有此类文件或文件或目录,在本机错误时打开“/tmp/mt-1miyjxv/os.json”?
如何使 Python 脚本独立可执行以在没有任何依赖项的情况下运行? [复制]
如何在不打开任何对话框的情况下在 Facebook 上发布消息?
如何在不使用本机代码的情况下要求用户在 NativeScript 上启用蓝牙
如何在没有任何签名的情况下使用已处理的应用程序运行 Wear 应用程序?我的意思是开发人员调试模式
如何使用可以在没有 .net 框架的情况下运行的 UWP / Window 窗体 / WPF 创建独立的 exe(没有任何依赖项)?