我刚刚安装了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点声望。
答案 0 :(得分:2)
执行命令
android
在您的sdk / tools目录中打开Android管理器。选择“SDK build tools version 24.0.1”并安装它。你需要使用Android管理器,而不是安装了反应无法检测的版本的Android Studio。
答案 1 :(得分:0)
我解决了这个问题。
android list sdk -a
这给了我可用于安装的软件包列表,然后我选择了我需要的软件包。
android update sdk -a -u -t [number from list of what I wanted to install]
感谢您的帮助。
答案 2 :(得分:0)
我遇到了类似的错误,原因是我在安装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
这适合我。
答案 3 :(得分:-1)
为android文件夹中的gradle.properties设置代理。它会自动为您下载Build Tool:
systemProp.http.proxyHost=proxyHost
systemProp.http.proxyPort=proxyPort
systemProp.https.proxyHost=proxyHost
systemProp.https.proxyPort=proxyPort