Thursday, January 7, 2016

Using a java library created with Android Studio, throws the following error in the build, when you include it in another project:

Error:com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)

The fix, dumb as it is, is to include the following two settings in the build.gradle file for the library, in the project.

sourceCompatibility = 1.7 
targetCompatibility = 1.7

after inclusion, it should look something like this:

apply plugin: 'java'
sourceCompatibility = 1.7
targetCompatibility = 1.7
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'junit:junit:4.12'
}

No comments:

Post a Comment