Sunday, November 8, 2009

No Targets Available for the Android SDK

The Android SDK uses an integer to identify the minimum SDK version for which your application is compiled. Without it, older versions of the Android OS could attempt to launch a program written for a newer version of Android and it might not be pretty.

When you first install the Android SDK (version 2.0 pre-release) and the Eclipse ADT, then attempt to create a new Android Project, you might see this warning: "Error: Target id is not valid. Use 'android list targets' to get the target ids". Following this instruction leads you to find that no target SDKs have been installed.

I believe Googled has packaged the 2.0 release to be an upgrade to the 1.6 release. However, they don't make that notion clear one way or the other. My solution? Skip it, go to the SDK v1.6 download page and get that instead. This becomes really obvious if you examine the size of the tarballs (2.0 = 24Mb, 1.6 = 573Mb).

2 comments:

  1. That's odd. Did you try using the "Android SDK and AVD Manager", as described at http://developer.android.com/sdk/adding-components.html (not clear from your post if you had)? When I first installed the Android 2.0 SDK recently, I ran into the same problem and kept on looking at "Window > Preferences > Android Preferences" to see no SDK targets listed. It took a little digging to determine that I had to add the different SDKs as components, and once I came across the page I was able to get the different SDK platforms I needed (1.5, 1.6, and 2.0). Things worked nicely after that.

    ReplyDelete
  2. In Eclipse, Window -> Preferences. Open the android tab and add the location to your android-sdk-windows folder.

    ReplyDelete