-
Notifications
You must be signed in to change notification settings - Fork 116
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 failure: signature-polymorphic method called without --min-sdk-version >= 26 #145
Comments
This appears to be a change to an internal class in gradle that this plugin depends on. The change is in 3.5 and 3.4.1 still continues to work as a current work around. I will be updating tests and the source to NO longer depend on the internal gradle classes as this is the second time its caused the plugin to break. |
Turns out the breaking change was from Gradle 3.2 to 3.3 where an interface had a method added to it. I updated the tests to include 3.5 and before fixing this change they were still passing. So it looks like there is still something else going on in your issues. Once #146 gets merged in you can try out the 1.2.0-SNAPSHOT and see if it resolves your issue. |
Great, thanks for the quick reply. I am indeed using Gradle 3.4.1 so it's a strange issue. I'll wait for the merge |
@AndrewReitz I see you merged the change, but I don't see a 1.2.0-SNAPSHOT on bintray. I'm still getting errors. I tried switching around my Gradle versions but to no avail. Are the following versions correct?
|
I haven't tested anything using any of the alpha builds since I'm only one person and google seems to change stuff so much. An easy way to test newer version is to just add another row to the data table in the full test spec and run For the snapshots you need to use the jcenter's snapshot repo instead of the regular jcenter repo. Directions to add this are on in the README. |
how did it solved? |
@yangxinQA Hey, sorry for the late reply, I am just getting back at my app. I solved it for one of my classes by removing
If that doesn't work for you, I'm afraid I can't help :(. Maybe @AndrewReitz has some more ideas. |
@nathanwharvey are you still seeing this issue? |
I have just run into this when trying to use |
I was experiencing the same issue and i can confirm that using |
@nite2 The only difference between 1.2.0 and 1.3.0-SNAPSHOT is the version number so I don't think that's what solved the issue. Maybe an update to the gradle android plugin fixed the issue? |
@AndrewReitz I am not saying that this issue wasn't resolved in 1.2.0-SNAPSHOT as you have suggested in previous comment, what i was communicating is that i was having the issue when using version 1.2.0 (not 1.2.0-SNAPSHOT), then upgraded to 1.3.0-SNAPSHOT and the problem was gone. Was the fix #146 included in the "main" 1.2.0 release? |
Yeah, #146 was included. As of right now, the only difference between 1.2.0 and 1.3.0-SNAPSHOT is the version number https://github.com/groovy/groovy-android-gradle-plugin/commits/master. |
What about new gradle (4.1) ? |
I've done a little bit of research and this seems to be caused by a new check in Dalvik, see https://android.googlesource.com/platform/dalvik/+/cdef1ee858fde291205f3da685b2720227d2d42f/dx/src/com/android/dx/cf/code/Simulator.java |
I've just gotten rid of the problem by patching the grooid library (deleted packages "indy" and "vmplugin/v7" and made sure that Option CompilerConfiguration.INVOKEDYNAMIC was false). |
@b-demuth any chance you can host the patched version somewhere or show us how to do it? |
Created a ticket: https://issues.apache.org/jira/browse/GROOVY-8366 |
I'm at the droidcon right now, but I'll see if I can host the patched version next week. I literally just deleted said packages and the line "if (Boolean.TRUE.equals(optOptions.get(CompilerConfiguration.INVOKEDYNAMIC))) invokedynamic=true;" in class "WriterController" in the 2_4_X branch of groovy (which was easier for me than setting that parameter in the optOptions :)). Also, I switched off some of the documentation related parts of the build process and jar signing, so my patched version is UNSIGNED. |
Cool. I used JarJar to remove the packages right now, haven't tested it. If it works I can submit the PR to Groovy project. Also, going to submit a ticket with build tools team. SideNote: Were you having issues with the javadocs part of the build process? |
I think another workaround is to use proguard to remove those packages as well. |
Looks like the tools team will not be fixing it. The suggested fix is to "minify" the code (Progaurd) The good news is that we are getting invoke dynamic on 26+ |
Looks like the jarjar rule of |
PR Here: apache/groovy#631 |
I saw update to AGP to 3.0.0 and I try it. When I set minifyEnabled to false come back to initial error : Is it mandatory to set minifyEnabled to true to make groovy plugin works ? |
Here's how you can make a groovy jar without the invoke dynamic class included for a workaround until the issue is resolved. https://gist.github.com/AndrewReitz/3e1145d66a8ef3f7b578d8604ecd671c |
I've been trying this workaround and the build succeeds. Unfortunately, the application crashes at runtime when calling method
Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
General error during class generation: can't load this type of class file
Any guess? |
@vincentganneau I don't think that's related to this issue. The class files created by groovy are for the JVM, when you load them on an Android device they need to be converted to Dalvik bytecode. Here's an example of how this can be done https://github.com/melix/grooidshell-example. Although I haven't been able to get this to work on newer version of Android. |
add |
I am getting a strange bug when building, even with a fresh project. The error only occurs when groovy is being compiled. Here is the module's build.gradle:
And here is the project's build.gralde:
I am using Gradle version 3.4.1. Here is the output from building:
I also tried copying the sample app and got the same error.
The text was updated successfully, but these errors were encountered: