Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle command line : failed to find target android-22 [duplicate]

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:

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:

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.

like image 231
rvogel Avatar asked May 21 '15 12:05

rvogel


1 Answers

Expecting that you use android studio...

Firstly check the build.gradle file of a previous app or just create a new one and check the build.gradle file.

Check the build.gradle file of the app which gives this issue. Just change it according to build.gradle in the running app.

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.

like image 53
Vinay Jaju Avatar answered Oct 04 '22 15:10

Vinay Jaju