Ricky Stewart
Ricky Stewart

Reputation: 1142

Installing version 16 of the Android SDK tools

I'm trying to build a project in Android Studio that targets API16 (Android version 4.1.2). Using the SDK manager I was able to download that SDK platform but an exception is raised at compile-time as it's trying to parse a compiled .jar file:

bad class file magic (cafebabe) or version (0034.0000)

My understanding of this issue is that I need the build tools to match the API version I'm targeting (since I currently only have the most recent version of the build tools). However, I am unable to install them because they're unavailable in both the SDK manager and on the Android website (http://developer.android.com/tools/revisions/build-tools.html). Is there another way to install this version of the build tools? (Alternatively, if installing that version of the build tools is unnecessary, how do I resolve this issue?)

Upvotes: 0

Views: 1092

Answers (1)

matiash
matiash

Reputation: 55350

This is a problem with the Java version (i.e. the version the jar, or rather the class files inside it, was compiled with). It actually has nothing to do with the Android version.

0x34 means the jar was compiled with Java 8 (see the list of possible values here). Android can only use jars compiled as Java 6.

If you have the sources for this library, you should recompile it again with the -target 1.6 flag.

Upvotes: 1

Related Questions