android - react- native : 'adb' is not recognized as an internal or external command, 可运行程序或批处理文件

标签 android react-native

我是 react-native android 应用程序开发的新手。请帮我解决这个问题。

我无法运行我的第一个应用程序,出现错误,因为 adb' 未被识别为内部或外部命令、可运行程序或批处理文件。

我检查了 android sdk->platform-tools->我可以在那里看到 adb.exe。

构建成功,但在运行时出现错误。下面是我的 cmd 提示符

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>

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

谢谢。

最佳答案

我找到了解决方案。

你所要做的就是在系统变量中添加adb路径。

复制adb位置,然后转到控制面板->系统->高级系统设置->环境变量->在系统变量下你会找到PATH变量,先选择它并点击编辑,然后单击新建并粘贴您的 adb 路径,现在单击确定。问题就解决了。

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

希望这对某人有帮助。感谢您查看我的问题。

关于android - react- native : 'adb' is not recognized as an internal or external command, 可运行程序或批处理文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43567579/

相关文章:

ios - xcode 8.2 中显示 'RCTLogLevel' 错误的重新定义

android - 如何在Android listview中实现分页

java - Android 客户端 TCP

reactjs - react native : mapping though a mounted non-null value

javascript - 构造函数 props 状态 vs 简单状态

css - 是否有相当于 :hover in react-native-web? 的值

带有适配器回收单元的android gridview header 解决方案

android - 在 android 模拟器中运行系统应用程序

java - 尝试添加 Firebase UI 2.3.0 时,我不断收到 gradle 同步错误

react-native - 裸工作流上的 getDevicePushTokenAsync 错误