I'm trying to use a library that uses java 8 in my android project. I cannot find a way to make this work. I've tried to use retro lambda but it has not helped. I keep getting the error: com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version(0034.0000)
I've researched this and learned it's because there is java 8 syntax in the included library. I've been compiling with java 8 sdk and am using android studio 08.2. Help! The library is:https://github.com/robrua/Orianna
Wait for android to support Java8.
Use an earlier version of the library that isn't Java8 and/or ask the developer of the library to provide one/ the last Java6 (or Java7 for kitcat upwards) library.
This is some kind of hack and I haven't tested or even used it!
Use retrolambda to backport the Java8-bytecode to Java6. On the homepage of retrolambda you find some documentation about it. Downloads of retrolambda are here.
Probably you will have to unzip the library jar to a folder and the run a command like the following:
java -Dretrolambda.inputDir=<extracted_classfiles>
-Dretrolambda.classpath=<extracted_classfiles>
-Dretrolambda.bytecodeVersion=50
-javaagent:retrolambda.jar
-jar retrolambda.jar
Maybe you have to extend the classpath depending on the dependencies of the library. Then you have to copy the resulting jar-file into your android-project's lib folder.
It is also possible to program Java8 for android.
If retrolambda doesn't work maybe you can find another tool to backport Java8-bytecode to Java6-bytecode.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With