【问题标题】:Failed to find Build Tools revision 24.0.1 with react-native使用 react-native 找不到 Build Tools 修订版 24.0.1
【发布时间】:2016-07-31 02:06:45
【问题描述】:

我刚刚安装了 React Native 和 Android Studio。我在 ubuntu 14.04 LTS 上,我正在尝试运行

react-native run-android

但我有这样的错误

Starting JS server...
Running /home/marta/Android/Sdk/platform-tools/adb reverse tcp:8081 tcp:8081
error: no devices/emulators found
Could not run adb reverse: Command failed:/home/marta/Android/Sdk/platform-tools/adb reverse tcp:8081 tcp:8081
Building and installing the app on the device (cd android && ./gradlew installDebug...

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> failed to find Build Tools revision 24.0.1

* 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: 6.992 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:
https://facebook.github.io/react-native/docs/android-setup.html

我也查了

android list sdk -a

我安装了

Installing Archives:
Preparing to install archives
Downloading Android SDK Platform-tools, revision 24.0.1
Installing Android SDK Platform-tools, revision 24.0.1
Stopping ADB server succeeded.
Installed Android SDK Platform-tools, revision 24.0.199%)
Stopping ADB server succeeded.
Starting ADB server succeeded.
Done. 1 package installed.

这就是我的 build.gradle 文件的样子

http://i.imgur.com/xWGnMTY.png

你知道出了什么问题吗?

很抱歉没有发布照片,但显然我需要 10 点声望。

【问题讨论】:

  • error: no devices/emulators found... 运行adb devices。有联系吗?
  • 那么下面...Make sure you have an Android emulator running or a device connected and have set up your Android development environment:
  • 虽然...根据您的 build.gradle,您使用的是 23.0.1,因此该错误没有任何意义。
  • 可能您已安装构建工具修订版 24.0.1,但在您的 gradle 中您将构建工具修订版声明为 23.0.1。这只是猜测,没有您提供更多信息。能否请您打开 Android SDK Manager 并检查您的计算机上安装了哪些组件?

标签: android android-studio react-native


【解决方案1】:

运行:

android

在您的 sdk/tools 目录中打开 Android 管理器。选择“SDK build tools version 24.0.1”并安装它。您需要使用 Android 管理器而不是 Android Studio 来执行此操作,因为 Android Studio 安装了无法检测到反应的版本。

【讨论】:

    【解决方案2】:

    我解决了这个问题。

    android list sdk -a
    

    这给了我可供安装的软件包列表,然后我选择我需要的。

    android update sdk -a -u -t [number from list of what I wanted to install]
    

    感谢您的帮助。

    【讨论】:

      【解决方案3】:

      我遇到了类似的错误,原因是我在安装 SDK 构建工具 24.0.2 后删除了 SDK 构建工具 24.0.1。

      我从这里找到了解决问题的另一种方法:http://www.garasiku.web.id/web/joomla/index.php/android/91-android-studio-2-1-3-failed-to-find-build-tools-revision-24-0-1

      简单的复制和粘贴。

       1: Change project view to Android
       2: Go to Grandle Scripts and open "build.gradle (Module:app)" 
       3: change buildToolsVersion "24.0.1"  ->    buildToolsVersion "24.0.2" 
              ...
              android {
                  compileSdkVersion 24
                  buildToolsVersion "24.0.1" 
              ...
       4. Sync your project
      

      这对我很有效。

      【讨论】:

        【解决方案4】:

        在 android 文件夹中为您的 gradle.properties 设置代理。它会自动为你下载 Build Tool:

        systemProp.http.proxyHost=proxyHost
        systemProp.http.proxyPort=proxyPort
        
        systemProp.https.proxyHost=proxyHost
        systemProp.https.proxyPort=proxyPort
        

        【讨论】:

          猜你喜欢
          • 2016-11-24
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2017-03-02
          • 1970-01-01
          • 1970-01-01
          • 2016-12-18
          • 1970-01-01
          相关资源
          最近更新 更多