react- native:'adb'不被识别为内部或外部命令,可操作的程序或批处理文件

问题描述:

刚接触反应原生android应用程序开发。请帮我解决这个问题。react- native:'adb'不被识别为内部或外部命令,可操作的程序或批处理文件

我不能够运行我的第一个应用程序,我得到错误的adb' is not recognized as an internal or external command, operable program or batch file.

我的Android sdk->平台 - 工具 - 内部检查>我可以看到adb.exe那里。

构建是成功的,但在运行时出现错误。下面是我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> 

我不使用仿真器,用我自己的移动设备。应用程序在我的设备中启动,但我看到的只是一个白色的空白屏幕。正如官方网站所述,我遵循了所有的指示。

谢谢。

我找到了解决方案。

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

复制ADB位置,并转到Controlpanel->系统 - > Advnaced系统设置 - >环境变量 - >系统变量,你会发现PATH变量,SELCT首先,点击编辑,然后单击New并粘贴adb路径,现在点击确定。这就解决了问题。

现在重新启动命令提示符,并运行react-native run-android。它的工作原理:)

希望这可以帮助别人。感谢您检查我的问题。

您看到黑屏,因为你的服务器没有运行或停止

你运行adb reverse如果您使用USB

尝试连接笔记本电脑和移动到相同的无线网络,然后输入你的IP调试:在开发8081设置

我有这个问题很多次,给出的答案是definetly的方式来解决它,但我最近再次得到这个错误,但构建成功,我无法修复它这种方式。我发现这是模拟器的互联网连接错误。

只要重新启动模拟器,如果你有这个,并确保你可以在互联网上打开谷歌浏览器。