ReactNative:试图运行我的第一个应用程序

ani*_*oui 2 javascript android facebook build react-native

我试图运行我的react-native项目,但是我得到了这个错误:

Aniss-Cherkaoui:AwesomeProject Error_404 $ react-native run-android启动JS服务器.../bin/sh:adb:command not found在设备上构建和安装应用程序(cd android && ./gradlew installDebug ...:app :preBuild UP-TO-DATE:app:preDebugBuild UP-TO-DATE:app:checkDebugManifest:app:preReleaseBuild UP-TO-DATE:app:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE:app:prepareComAndroidSupportRecyclerviewV72301Library UP-TO-DATE:app: prepareComAndroidSupportSupportV42321Library UP-TO-DATE:应用:prepareComFacebookFrescoDrawee0110Library UP-TO-DATE:应用:prepareComFacebookFrescoFbcore0110Library UP-TO-DATE:应用:prepareComFacebookFrescoFresco0110Library UP-TO-DATE:应用:prepareComFacebookFrescoImagepipeline0110Library UP-TO-DATE:应用:prepareComFacebookFrescoImagepipelineBase0110Library UP-TO-日期:app:prepareComFacebookFrescoImagepipelineOkhttp30110Library UP-TO-DATE:app:prepareComFacebookReactReactNative0370Library UP-TO-DATE:app:prepareComFacebookSoloaderSoloader010Library 最新消息:app:prepareOrgWebkitAndroidJscR174650Library UP-TO-DATE:app:prepareDebugDependencies:app:compileDebugAidl UP-TO-DATE:app:compileDebugRenderscript UP-TO-DATE:app:generateDebugBuildConfig UP-TO-DATE:app:generateDebugAssets UP -TO-DATE:app:mergeDebugAssets UP-TO-DATE:app:generateDebugResValues UP-TO-DATE:app:generateDebugResources UP-TO-DATE:app:mergeDebugResources UP-TO-DATE:app:bundleDebugJsAndAssets SKIPPED:app:processDebugManifest UP -TO-DATE:app:processDebugResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> at index 4

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 10.769 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment.
Go to https://facebook.github.io/react-native/docs/getting-started.html
and check the Android tab for setup instructions.
Run Code Online (Sandbox Code Playgroud)

raj*_*ary 9

只需确保,您已经安装了sdk并正确设置了sdk和android platform-tools的路径.

检查.bashrc文件或在mac上检查.bashprofile.

或者另外,每当您运行应用程序时,您都可以这样做.

在项目文件夹中运行以下命令.(如果您遵循官方RN文档,这些路径将起作用).

export ANDROID_HOME =〜/ Library/Android/sdk

export PATH = $ {PATH}:$ {ANDROID_HOME}/tools

export PATH = $ {PATH}:$ {ANDROID_HOME}/platform-tools