我是一名新的安卓应用开发人员.请帮我解决这个问题.

我无法运行我的第一个应用程序,错误为adb' is not recognized as an internal or external command, operable program or batch file.

I checked inside android sdk->platform-tools->i can see adb.exe there.

生成已成功,但在运行时出错.下面是我的cmd prompt美元

Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.
E:\ReactWorkSpace\MyFirstApp>react-native run-android
Scanning 560 folders for symlinks in E:\ReactWorkSpace\MyFirstApp\node_modules (72ms)
JS server already running.
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
Incremental java compilation is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library
:app:prepareComAndroidSupportRecyclerviewV72340Library
:app:prepareComAndroidSupportSupportV42340Library
:app:prepareComFacebookFbuiTextlayoutbuilderTextlayoutbuilder100Library
:app:prepareComFacebookFrescoDrawee101Library
:app:prepareComFacebookFrescoFbcore101Library
:app:prepareComFacebookFrescoFresco101Library
:app:prepareComFacebookFrescoImagepipeline101Library
:app:prepareComFacebookFrescoImagepipelineBase101Library
:app:prepareComFacebookFrescoImagepipelineOkhttp3101Library
:app:prepareComFacebookReactReactNative0434Library
:app:prepareComFacebookSoloaderSoloader010Library
:app:prepareOrgWebkitAndroidJscR174650Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:mergeDebugShaders
:app:compileDebugShaders
:app:generateDebugAssets
:app:mergeDebugAssets
:app:generateDebugResValues
:app:generateDebugResources
:app:mergeDebugResources
:app:bundleDebugJsAndAssets SKIPPED
:app:processDebugManifest
:app:processDebugResources
:app:generateDebugSources
:app:incrementalDebugJavaCompilationSafeguard
:app:compileDebugJavaWithJavac
:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:transformClassesWithDexForDebug
Running dex in-process requires build tools 23.0.2.
For faster builds update this project to use the latest build tools.
:app:mergeDebugJniLibFolders
:app:transformNative_libsWithMergeJniLibsForDebug
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug
:app:validateSigningDebug
:app:packageDebug
:app:assembleDebug
:app:installDebug
Installing APK 'app-debug.apk' on 'A16 - 4.2.2' for app:debug
Installed on 1 device.

BUILD SUCCESSFUL

Total time: 7 mins 4.412 secs
'adb' is not recognized as an internal or external command,
operable program or batch file.
Starting the app (D:\Android\sdk/platform-tools/adb shell am start -n com.myfirstapp/.MainActivity...
Starting: Intent { cmp=com.myfirstapp/.MainActivity }

E:\ReactWorkSpace\MyFirstApp>

我没有使用emulator,我使用的是我自己的移动设备.应用程序在我的设备上启动,但我看到的只是一个白色的空白屏幕.我按照官方网站上提到的所有说明进行了正确的操作.

非常感谢.

推荐答案

我找到了解决办法.

您只需在系统变量中添加adb路径.

Copy the adb location, and goto Controlpanel->System->Advnaced System Settings->Environment Variables->Under System Variables you will find PATH variable, selct that first and click on Edit, then click on New and paste your adb path, now click Ok. Thats it problem solved.

现在重新启动命令提示符,然后运行react-native run-android.有效:)

希望这对别人有帮助.谢谢你查看我的问题.

React-native相关问答推荐

莫迪德不会停留在屏幕中央

如何在react native 中从 axios 重定向并将数据传递给路由

useState 函数似乎阻止了 Animated.timing 事件?

如何获取 React Native 应用程序的崩溃日志(log)?

react-native: 'adb' 不是内部或外部命令、可运行程序或批处理文件

Visual Studio 2017 中的 React Native

NativeBase + Exponent Header

Yarn 在哪里存储离线包?

无法解析模块 react/lib/ReactUpdates

xcode 8.3 框架未找到架构 armv7 的 FileProvider

React Native 中的原生广告

渲染时获取未定义不是 React Native 中的对象

如何在react-native中设置 FlatList 的刷新指示器?

如何在 React Native 中使用 Jest

将 React Native 升级到 0.60-RC2 后找不到库libjsc.so

由于对 sourcetree 的 husky 预推送,Git 推送失败

INSTALL_FAILED_UPDATE_INCOMPATIBLE:包签名与之前安装的版本不匹配,忽略

如何将图形 API 与 react-native-fbsdk 一起使用?

将现有的 React Native 项目转换为 Expo

为什么 this.state 在react-native中未定义?