Dagger 2.10-rc1 won't compile in Android
See original GitHub issueI wanted to try the new features for activity and fragment injection in dagger.android but I get this gradle error stack trace when trying to update from v2.9 -> 2.10-rc1
`Dex: Error converting bytecode to dex: Cause: Dex cannot parse version 52 byte code. This is caused by library dependencies that have been compiled using Java 8 or above. If you are using the ‘java’ gradle plugin in a library submodule add targetCompatibility = ‘1.7’ sourceCompatibility = ‘1.7’ to that submodule’s build.gradle file. UNEXPECTED TOP-LEVEL EXCEPTION: java.lang.RuntimeException: Exception parsing classes at com.android.dx.command.dexer.Main.processClass(Main.java:775) at com.android.dx.command.dexer.Main.processFileBytes(Main.java:741) at com.android.dx.command.dexer.Main.access$1200(Main.java:88) at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1683) 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:695) at com.android.dx.command.dexer.Main.processAllFiles(Main.java:560) at com.android.dx.command.dexer.Main.runMultiDex(Main.java:376) at com.android.dx.command.dexer.Main.run(Main.java:290) at com.android.builder.internal.compiler.DexWrapper.run(DexWrapper.java:54) at com.android.builder.core.DexByteCodeConverter.lambda$dexInProcess$0(DexByteCodeConverter.java:173) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: 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:476) 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.parseClass(Main.java:787) at com.android.dx.command.dexer.Main.access$1600(Main.java:88) at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1722) at com.android.dx.command.dexer.Main.processClass(Main.java:773) … 16 more
warning: Ignoring InnerClasses attribute for an anonymous inner class (autovalue.shaded.org.apache.commons.lang.builder.HashCodeBuilder$1) that doesn’t come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any “-target” type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is not an inner class. warning: Ignoring InnerClasses attribute for an anonymous inner class (autovalue.shaded.org.apache.commons.lang.builder.ToStringStyle$1) that doesn’t come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any “-target” type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is not an inner class. Dex: Error converting bytecode to dex: Cause: Dex cannot parse version 52 byte code. This is caused by library dependencies that have been compiled using Java 8 or above. If you are using the ‘java’ gradle plugin in a library submodule add targetCompatibility = ‘1.7’ sourceCompatibility = ‘1.7’ to that submodule’s build.gradle file. UNEXPECTED TOP-LEVEL EXCEPTION: java.lang.RuntimeException: Exception parsing classes at com.android.dx.command.dexer.Main.processClass(Main.java:775) at com.android.dx.command.dexer.Main.processFileBytes(Main.java:741) at com.android.dx.command.dexer.Main.access$1200(Main.java:88) at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1683) 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:695) at com.android.dx.command.dexer.Main.processAllFiles(Main.java:587) at com.android.dx.command.dexer.Main.runMultiDex(Main.java:376) at com.android.dx.command.dexer.Main.run(Main.java:290) at com.android.builder.internal.compiler.DexWrapper.run(DexWrapper.java:54) at com.android.builder.core.DexByteCodeConverter.lambda$dexInProcess$0(DexByteCodeConverter.java:173) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: 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:476) 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.parseClass(Main.java:787) at com.android.dx.command.dexer.Main.access$1600(Main.java:88) at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1722) at com.android.dx.command.dexer.Main.processClass(Main.java:773) … 16 more `
is 2.10-rc1 not compatible with Android or is there configuration I need do?
Thanks.
Issue Analytics
- State:
- Created 7 years ago
- Comments:25
Top GitHub Comments
It’s not a Retrolambda problem. The classfiles in the artifact were compiled with a target of Java 8.
That syntax is invalid so I suspect your build is not actually picking up the new artifacts. Try this: