question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dagger 2.10-rc1 won't compile in Android

See original GitHub issue

I 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:closed
  • Created 7 years ago
  • Comments:25

github_iconTop GitHub Comments

4reactions
JakeWhartoncommented, Feb 23, 2017

It’s not a Retrolambda problem. The classfiles in the artifact were compiled with a target of Java 8.

3reactions
JakeWhartoncommented, Mar 4, 2017

That syntax is invalid so I suspect your build is not actually picking up the new artifacts. Try this:

compile "com.google.dagger:dagger:${dagger2}"
compile "com.google.dagger:dagger-android:${dagger2}"
compile "com.google.dagger:dagger-android-support:${dagger2}"

annotationProcessor "com.google.dagger:dagger-compiler:${dagger2}"
annotationProcessor "com.google.dagger:dagger-android-processor:${dagger2}"
Read more comments on GitHub >

github_iconTop Results From Across the Web

why does dagger 2 generated components gets deleted on ...
1 Answer 1 ... When you do a rebuild, the build system looks at the Dagger module and component classes and generates the...
Read more >
Dagger 2 updates (specifically for Android) : r/androiddev - Reddit
Can't say I like this change. Instead of straightforward "build component with this modules, then use it to inject" you get a "magical"...
Read more >
This is caused by library dependencies that have ... - CSDN博客
Dagger 2.10-rc1 won't compile in Android · Error converting bytecode to dex: Cause: Dex cannot parse version 52 byte code.
Read more >
archetype-catalog.xml
The application contains a custom GWT widgetset that is compiled by the GWT ... oak-archetype 1.0.9 com.willowtreeapps oak-dagger-api15-archetype 1.4.0 ...
Read more >
Untitled
0ad-0.0.20-alpha-unix-build.tar.xz 0ad-debug.patch 0ad-licensecheck.txt ... android-json-org-java.spec LICENSE-2.0.txt android-opengl-api.spec ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found