git Gradle 命令行:未能找到目标 android-22
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30373756/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Gradle command line : failed to find target android-22
提问by rvogel
I'm trying to build a project I pulled from a git repository and everything appears to be installed correctly, however when I run gradle I get the following message:
我正在尝试构建一个从 git 存储库中提取的项目,并且一切似乎都已正确安装,但是当我运行 gradle 时,我收到以下消息:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> failed to find target android-22 : /home/rvogel/android-sdk-linux/tools
* 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: 7.562 secs
I then ran the android report to see which targets I had installed:
然后我运行 android 报告以查看我安装了哪些目标:
rvogel: ~/StockApp $ android list target
Available Android targets:
----------
id: 1 or "android-22"
Name: Android 5.1.1
Type: Platform
API level: 22
Revision: 2
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
Tag/ABIs : no ABIs.
----------
Is there some other issue that's known to trigger this and I'm just not finding it?
是否还有其他一些已知的问题会触发此问题而我只是没有找到它?
UPDATE : I have long since given up on this, as it was a pet project trying to work on an android app remotely by using github to sync the project to a command line VM. However, as you may have been able to tell, or perhaps not since it was flagged as duplicate, I am not using Android Studio on the VM, I am running the entire project command line with an in browser IDE. The question that I am to have duplicated is specifically asking about Android Studio to which the solution is to download the correct version of Android. I am not using Android Studio and I have copied the print-out of my available targets, which indicated that the missing target is, in fact, installed on the machine.
更新:我早就放弃了这个,因为它是一个宠物项目,试图通过使用 github 将项目同步到命令行 VM 来远程处理 android 应用程序。但是,正如您可能已经知道的,或者可能不是因为它被标记为重复,我没有在 VM 上使用 Android Studio,我正在使用浏览器 IDE 运行整个项目命令行。我要重复的问题是专门询问解决方案是下载正确版本的 Android 的 Android Studio。我没有使用 Android Studio,我复制了可用目标的打印输出,这表明缺少的目标实际上已安装在机器上。
回答by Vinay Jaju
Expecting that you use android studio...
期待你使用android studio...
Firstly check the build.gradle file of a previous app or just create a new one and check the build.gradle file.
首先检查以前的应用程序的 build.gradle 文件,或者只是创建一个新应用程序并检查 build.gradle 文件。
Check the build.gradle file of the app which gives this issue. Just change it according to build.gradle in the running app.
检查出现此问题的应用程序的 build.gradle 文件。只需根据正在运行的应用程序中的 build.gradle 更改它。
Basically you'll have to change 2 main things here. Shown below:
基本上,您必须在这里更改两个主要内容。如下图:
compileSdkVersion = 21// add the version which is in your running project
buildToolsVersion = "21.1.2"/* add the version which is in your running project*/
minSdkVersion = 9
targetSdkVersion = 21/*same as your build.gradle of running app*/
After the changes, clean and rebuild your project. It should work.
更改后,清理并重建您的项目。它应该工作。
or
或者
You could download the required sdk versions.
您可以下载所需的 sdk 版本。