JordiCP Expert Licensed User Longtime User Apr 6, 2021 #1 I'm having exactly the same error as the user reported HERE when trying to desugar an AAR Code: Copy extract merge desugar Exception in thread "main" java.lang.IllegalStateException: Expected a load for Lxxxxxxxxxx; to set up parameter 2 for yyyyyyyyyy but got -1 at com.google.common.base.Preconditions.checkState(Preconditions.java:862) at com.google.devtools.build.android.desugar.LambdaDesugaring$InvokedynamicRewriter.attemptAllocationBeforeArgumentLoads(LambdaDesugaring.java:543) at com.google.devtools.build.android.desugar.LambdaDesugaring$InvokedynamicRewriter.visitInvokeDynamicInsn(LambdaDesugaring.java:427) .... In the last post of that thread @Erel mentioned It means that the library is not compatible with the desugar tool. Might require a new version of the tool. You can try to do it with Android Studio and get the desugarred jar. Click to expand... Where should I find a new version of the tool, or any hint regarding how to do it with Android Studio? Thanks in advance
I'm having exactly the same error as the user reported HERE when trying to desugar an AAR Code: Copy extract merge desugar Exception in thread "main" java.lang.IllegalStateException: Expected a load for Lxxxxxxxxxx; to set up parameter 2 for yyyyyyyyyy but got -1 at com.google.common.base.Preconditions.checkState(Preconditions.java:862) at com.google.devtools.build.android.desugar.LambdaDesugaring$InvokedynamicRewriter.attemptAllocationBeforeArgumentLoads(LambdaDesugaring.java:543) at com.google.devtools.build.android.desugar.LambdaDesugaring$InvokedynamicRewriter.visitInvokeDynamicInsn(LambdaDesugaring.java:427) .... In the last post of that thread @Erel mentioned It means that the library is not compatible with the desugar tool. Might require a new version of the tool. You can try to do it with Android Studio and get the desugarred jar. Click to expand... Where should I find a new version of the tool, or any hint regarding how to do it with Android Studio? Thanks in advance
DonManfred Expert Licensed User Longtime User Apr 6, 2021 #2 JordiCP said: Where should I find a new version of the tool, or any hint regarding how to do it with Android Studio? Click to expand... maybe here? Use Java 8 language features and APIs | Android Studio | Android Developers Discover the Java 8 language features you can use, how to properly configure your project to use them, and any known issues you may encounter. developer.android.com Upvote 0
JordiCP said: Where should I find a new version of the tool, or any hint regarding how to do it with Android Studio? Click to expand... maybe here? Use Java 8 language features and APIs | Android Studio | Android Developers Discover the Java 8 language features you can use, how to properly configure your project to use them, and any known issues you may encounter. developer.android.com
JordiCP Expert Licensed User Longtime User Apr 6, 2021 #3 Thanks Don. The link certainly talks about desugaring, but it's talking about Android Studio projects. I can't figure out how to do the simple process to desugar an existing jar so that it can be referenced in a B4A project (probably my fault, I'm not expert in Android Studio) Upvote 0
Thanks Don. The link certainly talks about desugaring, but it's talking about Android Studio projects. I can't figure out how to do the simple process to desugar an existing jar so that it can be referenced in a B4A project (probably my fault, I'm not expert in Android Studio)
moster67 Expert Licensed User Longtime User Apr 6, 2021 #4 Do you have the source of the library module that generates the AAR package? If yes, I could try and see if I can recompile the library with the "coreLibraryDesugaringEnabled" set to true. Oops: just saw that was the link Don already posted. See here: B4X: Copy https://developer.android.google.cn/studio/releases?hl=en#4-0-0-desugar The docs talk about the app's build gradle file. I am not sure if it can be applied to the library's build grade file. Otherwise, Don't know if this can be of any help. It talks about a standalone tool. B4X: Copy https://www.reddit.com/r/androiddev/comments/m4cryu/generate_a_desugared_jar_using_a_standalone/ I wished I could be of further help. Perhaps Erel has some more information and if it can be resolved. Last edited: Apr 6, 2021 Upvote 0
Do you have the source of the library module that generates the AAR package? If yes, I could try and see if I can recompile the library with the "coreLibraryDesugaringEnabled" set to true. Oops: just saw that was the link Don already posted. See here: B4X: Copy https://developer.android.google.cn/studio/releases?hl=en#4-0-0-desugar The docs talk about the app's build gradle file. I am not sure if it can be applied to the library's build grade file. Otherwise, Don't know if this can be of any help. It talks about a standalone tool. B4X: Copy https://www.reddit.com/r/androiddev/comments/m4cryu/generate_a_desugared_jar_using_a_standalone/ I wished I could be of further help. Perhaps Erel has some more information and if it can be resolved.
JordiCP Expert Licensed User Longtime User Apr 6, 2021 #5 Hi Mike, moster67 said: Do you have the source of the library module that generates the AAR package? Click to expand... No, unfortunately I don't have access to the sources, just the lib. Thanks for the bazel link, also found it and gave me some hope that this can solve the issue. Downloaded the 4.0 (I think, not in front of my other PC now) release and the sources, and tried to build a new 'desugarer' following the instructions. However, the process crashed after 5 minutes due to some jni.h header not found. It was in my Windows PC, will try later in my Mac just in case something is different. Interesting, now I see that at the end of the same link that a user suggests to use directly D8 since it has support for standard jars It's incredible the amount of hours that one can spend when such problems appear... Thanks for your time Upvote 0
Hi Mike, moster67 said: Do you have the source of the library module that generates the AAR package? Click to expand... No, unfortunately I don't have access to the sources, just the lib. Thanks for the bazel link, also found it and gave me some hope that this can solve the issue. Downloaded the 4.0 (I think, not in front of my other PC now) release and the sources, and tried to build a new 'desugarer' following the instructions. However, the process crashed after 5 minutes due to some jni.h header not found. It was in my Windows PC, will try later in my Mac just in case something is different. Interesting, now I see that at the end of the same link that a user suggests to use directly D8 since it has support for standard jars It's incredible the amount of hours that one can spend when such problems appear... Thanks for your time
moster67 Expert Licensed User Longtime User Apr 6, 2021 #6 JordiCP said: Interesting, now I see that at the end of the same link that a user suggests to use directly D8 since it has support for standard jars Click to expand... Good catch. I did not see that. Hope you can execute that and resolve your problem. Upvote 0
JordiCP said: Interesting, now I see that at the end of the same link that a user suggests to use directly D8 since it has support for standard jars Click to expand... Good catch. I did not see that. Hope you can execute that and resolve your problem.
JordiCP Expert Licensed User Longtime User Apr 7, 2021 #7 moster67 said: Good catch. I did not see that. Click to expand... Finally solved downloading that R8 version with experimental support for class files and a giant command line. ? Thanks @DonManfred and @moster67 ? Upvote 0
moster67 said: Good catch. I did not see that. Click to expand... Finally solved downloading that R8 version with experimental support for class files and a giant command line. ? Thanks @DonManfred and @moster67 ?