8

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.

rvogel
  • 83
  • 1
  • 1
  • 9
  • Do you have the Android-22 SDK installed? – crea1 May 21 '15 at 12:55
  • Yes, I ran android update sdk to install android-22. As far as I'm aware, android list target only shows versions currently installed. – rvogel May 21 '15 at 12:56
  • Whoops, you've already mentioned that, sorry. – crea1 May 21 '15 at 12:58
  • I had this issue a couple days ago, I remember going to the folder where android-22 was supposedly installed (for you, that's `/home/rvogel/android-sdk-linux/platforms/android-22` and the actual folder android-22 was either missing or empty. My solution, I believe, was to run the following command: `android sdk update -u --filter platforms`. It started installing all the sdks so I just cancelled it after it had installed android-22 and started downloading 21, and that was what eventually worked – Joseph Roque May 21 '15 at 13:37
  • My android-22 folder appears to be populated properly. I checked android list sdk and Android 22 is not an option, indicating it's already installed. – rvogel May 21 '15 at 13:54
  • Have you tried whats happens if you [change the compile version](http://stackoverflow.com/a/18085127/3923525) to another version? – jmm Jun 01 '15 at 18:58
  • 1
    Do you have **Android SDK Build-tools, revision 22.0.1**? It's in the **Tools** section of _Android SDK Manager_. – Babak Jul 05 '15 at 07:42

1 Answers1

3

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.

Vinay Jaju
  • 627
  • 8
  • 14