Skip to content
This repository has been archived by the owner on May 1, 2020. It is now read-only.

Cannot build with Java 1.8 #53

Closed
ekchang opened this issue Jan 29, 2015 · 2 comments
Closed

Cannot build with Java 1.8 #53

ekchang opened this issue Jan 29, 2015 · 2 comments

Comments

@ekchang
Copy link

ekchang commented Jan 29, 2015

Not sure if this is known, but installing Rebound using JDK 1.8u25 fails (both Playground and Example). It's weird because Gradle says the build succeeds until I try to push it to a device. JDK 1.7u75 has no issues, so I'm not too sure exactly what's going on. I don't see any specific build.gradle or settings.gradle files which specify a JDK version to build with either.

Error occurs during preDexDebug:

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
at com.android.dx.command.dexer.Main.processClass(Main.java:665)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634)
at com.android.dx.command.dexer.Main.access$600(Main.java:78)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:596)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
at com.android.dx.command.dexer.Main.run(Main.java:230)
at com.android.dx.command.dexer.Main.main(Main.java:199)
at com.android.dx.command.Main.main(Main.java:103)
...while parsing com/facebook/rebound/BaseSpringSystem.class

@willbailey
Copy link
Contributor

Can you try adding the following to your build.gradle? I haven't attempted to build with 1.8 as it's not supported for Android yet to my knowledge.

compileOptions {
targetCompatibility JavaVersion.VERSION_1_7
}

@ekchang
Copy link
Author

ekchang commented Feb 3, 2015

Looking deeper, you're right - 1.8 isn't officially supported for Android, only 1.6. The error (bad class file magic (cafebabe) or version (0034.0000)" refers to a mismatch between a library compiled in a version that isn't the SDK version (0034 refers to Java 1.8).

Adding the compile options to change target compatibility still doesn't work, but it's fine. The correct resolution is to just not compile with 1.8 at all.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants