Skip to content
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

Build errors when using Android Built tools 3.0.0-beta1 #22

Closed
peterhav opened this issue Aug 10, 2017 · 3 comments
Closed

Build errors when using Android Built tools 3.0.0-beta1 #22

peterhav opened this issue Aug 10, 2017 · 3 comments

Comments

@peterhav
Copy link

When using the 3.0.0-beta1, API 23 or lower and the following statement in the build.gradle file:

compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
}

causes the following exception during a build:

:app:transformClassesWithDesugarForDebug
Exception in thread "main" java.lang.IllegalStateException: Expect only the fields in this interface to be initialized. owner=org/apache/xmlbeans/impl/xb/ltgfmt/Code$1, expected=org/apache/xmlbeans/impl/xb/ltgfmt/Code
	at com.google.common.base.Preconditions.checkState(Preconditions.java:721)
	at com.google.devtools.build.android.desugar.InterfaceDesugaring$InterfaceFieldWriteCollector.visitFieldInsn(InterfaceDesugaring.java:260)
	at org.objectweb.asm.MethodVisitor.visitFieldInsn(Unknown Source)
	at org.objectweb.asm.tree.FieldInsnNode.accept(Unknown Source)
	at org.objectweb.asm.tree.InsnList.accept(Unknown Source)
	at org.objectweb.asm.tree.MethodNode.accept(Unknown Source)
	at com.google.devtools.build.android.desugar.LambdaDesugaring$InvokedynamicRewriter.visitEnd(LambdaDesugaring.java:383)
	at org.objectweb.asm.ClassReader.b(Unknown Source)
	at org.objectweb.asm.ClassReader.accept(Unknown Source)
	at org.objectweb.asm.ClassReader.accept(Unknown Source)
	at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:401)
	at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:326)
	at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:280)
	at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:583)


 FAILED

FAILURE: Build failed with an exception.

Steps to reproduce:
-create a new Sample project (API 23, no activity) in Android Studio using build tools 3.0.0-beta1 (note: problem only occurs when API < 24)
-add multidex to the build.gradle
-add the provided poishadow-all.jar to the libs dir
-run gradle assembleDebug: it will run fine
-add these lines to the build.gradle file:

 compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
}

-run gradle assembleDebug: it show the exception.

When the minsdk is changed to >23 the build will run fine.

@peterhav
Copy link
Author

Since I'm not sure if this is a problem in this project or in the Google build system, I also created a bug report in the Google issue tracker. It can be tracked here: https://issuetracker.google.com/issues/64552338

@peterhav
Copy link
Author

Just received notice that this is related to a bug. It should be solved in build tools 3.0.0-beta4...

@centic9
Copy link
Owner

centic9 commented Aug 12, 2017

Thanks for the note, I also expected it to be more related to the build tools themselves.

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

No branches or pull requests

2 participants