Building Android app 删除 adb 可执行文件

Building Android app deletes adb executable

我使用 react-native init ... 创建了一个新应用。根据文档安装 android 开发工具并尝试使用 react-native run-android 运行。

我遇到错误

FAILURE: Build failed with an exception.

  • What went wrong: A problem was found with the configuration of task ':app:installDebug'. File 'C:\Android\sdk\platform-tools\adb.exe' specified for property 'adbExe' does not exist.

  • 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: 1 mins 7.058 secs

我已经尝试了几次(删除然后重新安装 SDK 等),我注意到当我安装 SDK 和工具时,adb 安装在上述位置,但是当构建 started/emulator 开始或 android studio 加载项目时,它会消失(删除?)。

无论我 运行 react-native run-android 或在 Android Studio (3.0.1) 中打开 [AppFolder]\android 和 运行 [运行 > 运行 'app']

我把platform-tools文件夹复制到别处,androidstudio打开后替换了,androidstudio或模拟器运行过几秒adb还是消失了宁。如果我 运行 react-native run android 也一样。

相同的项目在 OS X 上运行良好。(克隆后我不得不手动 chmod +x gradlew项目,但认为这无关。)

配置

build.gradle 文件 (我没有改变这个 - 由 react-native cli 生成)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.2.3'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
 }
}

allprojects {
    repositories {
    mavenLocal()
    jcenter()
    maven {
        // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
        url "$rootDir/../node_modules/react-native/android"
    }
    }
}

SDK 安装后

在 运行ning android studio with project open/emulator started/ react-native 运行-android

您可以尝试将 adb.exe 放在其他地方,并确保它在路径中吗? 会不会是某些杀毒软件删除了它?