-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dagger 2.10-rc1 won't compile in Android #593
Comments
are you using retrolambda? |
It's not a Retrolambda problem. The classfiles in the artifact were compiled with a target of Java 8. |
This should be fixed in rc2 shortly |
Perfect, thanks very much |
@ronshapiro - once RC2 is out, could you share how you built it? (Unless it's more obvious at that point.) I tried and failed to build the dagger artifacts with a target of JDK 1.7, to better evaluate RC1. |
Assuming you have bazel installed, it's just `bazel build
//java/dagger/android` and `bazel build //java/dagger/android/support`. If
you're asking how to install it into maven local, you'd have to do
something similar to the `util/execute-deploy.sh` script.
…On Thu, Feb 23, 2017, 5:48 PM Uli Bubenheimer ***@***.***> wrote:
@ronshapiro <https://github.com/ronshapiro> - once RC2 is out, could you
share how you built it? (Unless it's more obvious at that point.) I tried
and failed to build the dagger artifacts with a target of JDK 1.7, to
better evaluate RC1.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#593 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAwY3WgvhTPLxaqaIA5yEiH0AzYFbaDBks5rfgzYgaJpZM4MJvdo>
.
|
Thanks - pretty sure that's what I did in terms of bazel build. It generated 1.8 artifacts. Had trouble figuring out how make Bazel generate 1.7 targets, but once I settled for passing through javac command-line options via --javacopt, I was not able to build dependencies that were using Java 8 source style. Hoping it will change with RC2. |
I think I found my error. I mistakenly thought that my hand-built Dagger Android libraries were the issue, when the real problem was the official plain dagger RC1 artifact from Maven. Thanks for the pointer! |
Any update on when we can expect RC2? |
@Modulo216 I'm building it right now actually :) |
Should be live (but Sonatype seems slow today) |
I've been having this same issue. I tested out RC2 and unfortunately the issue has persisted. I reverted to using a local android package and 2.9. However if you need more info for the setup or logs just let me know. |
RC2 classes are not compiled to v52.
…On Fri, Mar 3, 2017, 7:55 PM Jon Merritt ***@***.***> wrote:
I've been having this same issue.
I tested out RC2 and unfortunately the issue has persisted. I reverted to
using a local android package and 2.9. However if you need more info for
the setup or logs just let me know.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#593 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAEEESKHO_OqIirYd7CPtwpmrPmiHtPCks5riLaTgaJpZM4MJvdo>
.
|
@JakeWharton I apologise if I sound uninformed but I'm very much a novice still... You're saying the new build isn't J8 ready basically? Parsing byte code is well beyond my understanding sorry. |
RC1 was compiled requiring a Java 8 runtime or newer whereas RC2 only
requires Java 6 or newer. What makes you say the issues has persisted? Dex
is still complaining when you use RC2?
…On Fri, Mar 3, 2017, 8:33 PM Jon Merritt ***@***.***> wrote:
@JakeWharton <https://github.com/JakeWharton> I apologise if I sound
uninformed but I'm very much a novice still...
You're saying the new build isn't J8 ready basically? Parsing byte code is
well beyond my understanding sorry.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#593 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAEEESgNk6q3iehDNQm2cer4e3ug-ncJks5riL9fgaJpZM4MJvdo>
.
|
Yes it gives me the same error as the OP. 'Dec cannot parse version 52... ... targetCompatibilty=1.7...' My setup is similar as well, I'm using retroLambda etc... I'll be happy to make a fresh project and get what info you may need. |
Can you show all the lines in your build.gradle that include 'dagger'?
…On Fri, Mar 3, 2017 at 8:41 PM Jon Merritt ***@***.***> wrote:
Yes it gives me the same error as the OP.
'Dec cannot parse version 52... ... targetCompatibilty=1.7...'
My setup is similar as well, I'm using retroLambda etc...
I'll be happy to make a fresh project and get what info you may need.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#593 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAEEEU0p-qA_4X71S8hIAVOJ6PXThpGFks5riMFYgaJpZM4MJvdo>
.
|
`build.gradle compile "com.google.dagger:/dagger:${dagger2}" annotationProcessor "com.google.dagger:dagger-compiler:${dagger2}" annotationProcessor "com.google.dagger:dagger-android:processor${dagger2}" - Unsure if this is needed, error is the same with or without however. |
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}" |
Thank you. I will report back as soon as I can. That must be the issue though. Surprised the way I was doing it picked up at all... That / in there was because I didn't know how to stop the little dagger icon from replacing the word. Anyway, I'll be able to test this again soon and I'll let you know, thank you again. |
All set. That was exactly it. You're like a laser with this stuff. Thank you for this, and all you've taught me too. Sorry for all the notifications everyone. |
What about |
Still reproducible with '2.11-rc2', even with 2.10 |
I'm using |
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.
The text was updated successfully, but these errors were encountered: