groovy
groovy copied to clipboard
Android: Remove Invoke Dynamic Call
Uses jarjar to remove org.codehaus.groovy.vmplugin.v7.IndyInterface which has a invoke dynamic call. This call causes android compilation to fail when targeting sdk level 26 or above but the minSdk is less than 26.
Fixes: GROOVY-8366
Hi,
Is there anything new to the matter ? If I understand correctly, this issue blocks the evolution of the android-gradle-plugin
Is there anything we can do to help ? We actually need an update on the plugin for our application to still be compatible with older versions of Android.
This is actually a big problem. For Groovy on the JVM there is no other way, than to more and more depend on invokedynamic. I think the suggestion of an Android version of Groovy is the best. But I wonder if that is really more than - I am not into Android development, so be patient with my ignorance - using for example D8 to ensure a certain API level compatibility.
Thanks for the input. To my knowledge and as you guys previously outlined, the problem is - To quote google's documentation -
Desugar currently doesn't support MethodHandle.invoke or MethodHandle.invokeExact. If your source code or one of your module dependencies use one of these methods you need to specify minSdkVersion 26 or higher. Otherwise, you get the following error [...]
So yeah I guess D8 won't help, you're probably right on the best option suggestion. How hard would it be to implement an android version of Groovy, I'm really not familiar with the ways to port libraries.
It could be as easy as using retrolambda to transform the Groovy library. Then, as long as you use pre Groovy 3 it should work - maybe even for classes generated with Groovy 3. For later versions you may have to transform the classes outputted by Groovy. But I strongly assume you are not trying to run scripts anyway.