Jump to content
  • Advertisement
Sign in to follow this  
grumpyOldDude

Android studio Error: failed to find target with hash string 'android-21'

This topic is 1076 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello

 

Migrating my project from eclipse to Android Studio I am having this error:

 

Error:Cause: failed to find target with hash string 'android-21' 
 
 
I did "Open Android SDK Manager"  and installed all  latest and relevant updates but error persisted 
I am really stuck, Does anyone know what I have to do to Android Studio to find 'andriod-21'?

 

Any help appreciated 

Edited by alwaysGrey

Share this post


Link to post
Share on other sites
Advertisement

Moving to Mobile forum in the hopes of getting more relevant eyeballs.

 

Your message is a little unclear.  Is this an issue with Eclipse and its little hints?  Or is this an issue with compilation?

 

If it is a compilation issue, please give the full error message starting with the first one, and an exact copy/paste of the code mentioned in the error.

Share this post


Link to post
Share on other sites

Still stuck with same problem on Android Studio build....

 

Error:A problem occurred configuring project ':app'.
> failed to find target with hash string 'android-21' 
 
BUILD FAILED                                         
 
 
EDIT:  Looks conclusive now that even GD.net gurus don't  know, so Android Studio really really sucksangry.png , I'm sticking with eclipse
Edited by alwaysGrey

Share this post


Link to post
Share on other sites

In Android Studio, did you try look in Preferences,  under Apperance & Behaviour -> System Settings -> Android SDK ?

There you can choose to download specific API versions, make sure Android 5.0 (21) is downloaded...

 

Even if you have the latest SDK, you might not have the specific API version downloaded.

 

You can also change which API version it tries to look for with "compileSDKVersion" in your build.gradle, or if it was targetSDKVersion, don't remember. (I gave up on AS some months ago and am using Eclipse now, but it was for NDK reasons, I think AS should be ok for java dev)

Share this post


Link to post
Share on other sites

Many thanks for reply

 

when i read this,  I've been checking the AS menus and sub-menus all over to find Appearance and behaviour all over but couldn't. I sometimes miss things so 've been double checking but still couldn't find it. Could let me know the menu/submenu you are refering to.

 Lots of Thanks

[attachment=29565:AS.png]

 

 

Share this post


Link to post
Share on other sites

I'm on OSX, and have an extra menu to the left of "File" which has a "Preferences..." in it.

I'm not sure where "Preferences..." is on windows, maybe under "File"?

 

I seem to reach the same place if I also go to Tools->Android->SDK Manager

Share this post


Link to post
Share on other sites

yea Tool->Android->SDK Manager

 

First time i'm viewing this..., 've been looking around AS sdk manager and its not too dissimilar to the SDK manager on eclipse.

 

I can see how this would help sync/update the API, many thanks you are a life-saver.  

 

Though i've not fixed the problem yet, i'm hoping when i started again i should be able to fix.. Well maybe i shouldn't get too optimistic yet...  The reason I had more issues was i only stuck to this instructions http://developer.android.com/sdk/installing/migrate.html thinking that would do it

 

Would you still be alright using Eclipse after this year since Google is no longer supporting eclipse beyong 2015?

Share this post


Link to post
Share on other sites

Would you still be alright using Eclipse after this year since Google is no longer supporting eclipse beyong 2015?

 

It seems to work about as well as ever for me.

The main problem is all the documentation is defaulted to Android Studio now, but I think most of the eclipse documentation is still there, just slightly harder to reach.

 

Currently I'm using NVidias android bundle, it comes with eclipse, android sdk, ndk, and also comes with some nice extra tools to measure performance and debug. (havn't used those much yet though, mostly been using Intel GPA to debug OpenGL)

 

https://developer.nvidia.com/CodeWorks-Android

 

Since you are using windows, you might be happy to know they also have visual studio plugins, but I haven't had the opportunity to try them, so I don't know what exactly you can do with them.

Edited by Olof Hedman

Share this post


Link to post
Share on other sites

In Android Studio, did you try look in Preferences,  under Apperance & Behaviour -> System Settings -> Android SDK ?
There you can choose to download specific API versions, make sure Android 5.0 (21) is downloaded...
 
Even if you have the latest SDK, you might not have the specific API version downloaded.
 
You can also change which API version it tries to look for with "compileSDKVersion" in your build.gradle, or if it was targetSDKVersion, don't remember. (I gave up on AS some months ago and am using Eclipse now, but it was for NDK reasons, I think AS should be ok for java dev)

 

 

Many thanks Olof, Android studio is working, original issue is fix, though but my main project output seems weird. (working on that)  THANKS

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!