JordiCP Expert Licensed User Longtime User Feb 11, 2020 #1 I need to desugarize a couple of AARs that will be referenced from a B4A project. I've followed the process indicated HERE and I get an error in the 'desugarizing' phase of the process Code: Waiting for debugger to connect... Program started. extract merge desugar Exception in thread "main" java.lang.IllegalStateException at com.google.common.base.Preconditions.checkState(Preconditions.java:491) at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:620) at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:449) at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:391) at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:974) 1 I tried to run this step from the command line to see if I could get more info, and indeed I got a big log, but nothing that I can understand Spoiler Code: C:\Develop\Utils\DS\Files>java -verbose -jar ..\Desugar_deploy.jar --bootclasspath_entry=C:\Develop\Basic4Android\android-sdk-windows\platforms\android-28\android.jar --input=merged.jar --output=converted.jar [Opened C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded java.lang.Object from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded java.io.Serializable from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded java.lang.Comparable from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded java.lang.CharSequence from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] (.......skipping several hundreds of similar lines.......) [Loaded org.objectweb.asm.Frame from file:/C:/Develop/Utils/DS/Desugar_deploy.jar] [Loaded org.objectweb.asm.CurrentFrame from file:/C:/Develop/Utils/DS/Desugar_deploy.jar] [Loaded org.objectweb.asm.Type from file:/C:/Develop/Utils/DS/Desugar_deploy.jar] [Loaded java.util.Vector$Itr from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] Exception in thread "main" [Loaded java.lang.Throwable$PrintStreamOrWriter from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded java.lang.Throwable$WrappedPrintStream from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded java.util.IdentityHashMap$KeySet from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] java.lang.IllegalStateException at com.google.common.base.Preconditions.checkState(Preconditions.java:491) at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:620) at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:449) at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:391) at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:974) [Loaded java.util.IdentityHashMap$IdentityHashMapIterator from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded java.util.IdentityHashMap$KeyIterator from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded java.nio.file.SimpleFileVisitor from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded com.google.devtools.build.android.desugar.Desugar$2 from file:/C:/Develop/Utils/DS/Desugar_deploy.jar] [Loaded java.nio.file.FileVisitOption from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded java.nio.file.FileTreeWalker from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded java.util.RegularEnumSet$EnumSetIterator from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded java.nio.file.FileTreeWalker$DirectoryNode from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded java.nio.file.FileTreeWalker$Event from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded java.nio.file.FileTreeWalker$EventType from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded java.nio.file.Files$3 from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded java.nio.file.FileVisitResult from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] C:\Develop\Utils\DS\Files> Any hint will be welcome, I'm totally stuck in this.
I need to desugarize a couple of AARs that will be referenced from a B4A project. I've followed the process indicated HERE and I get an error in the 'desugarizing' phase of the process Code: Waiting for debugger to connect... Program started. extract merge desugar Exception in thread "main" java.lang.IllegalStateException at com.google.common.base.Preconditions.checkState(Preconditions.java:491) at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:620) at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:449) at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:391) at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:974) 1 I tried to run this step from the command line to see if I could get more info, and indeed I got a big log, but nothing that I can understand Spoiler Code: C:\Develop\Utils\DS\Files>java -verbose -jar ..\Desugar_deploy.jar --bootclasspath_entry=C:\Develop\Basic4Android\android-sdk-windows\platforms\android-28\android.jar --input=merged.jar --output=converted.jar [Opened C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded java.lang.Object from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded java.io.Serializable from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded java.lang.Comparable from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded java.lang.CharSequence from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] (.......skipping several hundreds of similar lines.......) [Loaded org.objectweb.asm.Frame from file:/C:/Develop/Utils/DS/Desugar_deploy.jar] [Loaded org.objectweb.asm.CurrentFrame from file:/C:/Develop/Utils/DS/Desugar_deploy.jar] [Loaded org.objectweb.asm.Type from file:/C:/Develop/Utils/DS/Desugar_deploy.jar] [Loaded java.util.Vector$Itr from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] Exception in thread "main" [Loaded java.lang.Throwable$PrintStreamOrWriter from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded java.lang.Throwable$WrappedPrintStream from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded java.util.IdentityHashMap$KeySet from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] java.lang.IllegalStateException at com.google.common.base.Preconditions.checkState(Preconditions.java:491) at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:620) at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:449) at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:391) at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:974) [Loaded java.util.IdentityHashMap$IdentityHashMapIterator from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded java.util.IdentityHashMap$KeyIterator from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded java.nio.file.SimpleFileVisitor from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded com.google.devtools.build.android.desugar.Desugar$2 from file:/C:/Develop/Utils/DS/Desugar_deploy.jar] [Loaded java.nio.file.FileVisitOption from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded java.nio.file.FileTreeWalker from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded java.util.RegularEnumSet$EnumSetIterator from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded java.nio.file.FileTreeWalker$DirectoryNode from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded java.nio.file.FileTreeWalker$Event from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded java.nio.file.FileTreeWalker$EventType from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded java.nio.file.Files$3 from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] [Loaded java.nio.file.FileVisitResult from C:\Program Files (x86)\Java\jre1.8.0_181\lib\rt.jar] C:\Develop\Utils\DS\Files> Any hint will be welcome, I'm totally stuck in this.
DonManfred Expert Licensed User Longtime User Feb 12, 2020 #2 Which java library do you want to implement? which aars are you using in the desugerprocess? Upvote 0
JordiCP Expert Licensed User Longtime User Feb 12, 2020 #3 Hi Don, I can't upload the files for NDA reasons. I'm aware that, without info, it's really difficult to get clues --> I posted the error logs just in case it was one of those situations where a given error was due to some 'known' general reason, or someone had experienced it with another library and the workaround to solve it could give me some hints. There are 2 aar files from the provider. Haven't wrapped anything on them yet. Their AS sample project builds and works correctly against SDK29. At this first stage, I just added the aar files (either together or separately) to an empty B4A project, in order to test some functionalities via Inline Java/JavaObject. Before adding any code, just with the #AdditionalJar declarations, I tried to compile the B4A project (with both minSDK 28 and 29) and gave me the famous error that indicated me that I needed to desugar the aars. So I used the Desugar B4J utility to do it. The process fails on the 'desugar' phase, throwing the errors posted above. Have googled for them, and they appear in some crash error reports of other unrelated libraries, but can't see anything. Will ask the project owner to get permission to send these files privately if this helps. Thanks! Upvote 0
Hi Don, I can't upload the files for NDA reasons. I'm aware that, without info, it's really difficult to get clues --> I posted the error logs just in case it was one of those situations where a given error was due to some 'known' general reason, or someone had experienced it with another library and the workaround to solve it could give me some hints. There are 2 aar files from the provider. Haven't wrapped anything on them yet. Their AS sample project builds and works correctly against SDK29. At this first stage, I just added the aar files (either together or separately) to an empty B4A project, in order to test some functionalities via Inline Java/JavaObject. Before adding any code, just with the #AdditionalJar declarations, I tried to compile the B4A project (with both minSDK 28 and 29) and gave me the famous error that indicated me that I needed to desugar the aars. So I used the Desugar B4J utility to do it. The process fails on the 'desugar' phase, throwing the errors posted above. Have googled for them, and they appear in some crash error reports of other unrelated libraries, but can't see anything. Will ask the project owner to get permission to send these files privately if this helps. Thanks!
DonManfred Expert Licensed User Longtime User Feb 12, 2020 #4 JordiCP said: I can't upload the files for NDA reasons Click to expand... np. Have you tried to update your java 8 installation with a newer release? 1.8.2xx Or even try with java 11? My answer is based on the endless references to rt.jar from your java 8 Upvote 0
JordiCP said: I can't upload the files for NDA reasons Click to expand... np. Have you tried to update your java 8 installation with a newer release? 1.8.2xx Or even try with java 11? My answer is based on the endless references to rt.jar from your java 8
JordiCP Expert Licensed User Longtime User Feb 12, 2020 #5 I have tried it, unfortunately same result. Thaks anyway (just sent you a message). Upvote 0
JordiCP Expert Licensed User Longtime User Feb 12, 2020 #6 Thanks to @DonManfred's help, who ran the desugar process with different Java versions, now we have a 'less cryptic' log. Still doesn't work, but hopefully give some useful info Logs with Java 8.202 Spoiler Code: extract merge desugar Exception in thread "main" java.lang.TypeNotPresentException: Type kotlin.jvm.functions.Function1 not present at sun.invoke.util.BytecodeDescriptor.parseSig(BytecodeDescriptor.java:85) at sun.invoke.util.BytecodeDescriptor.parseMethod(BytecodeDescriptor.java:63) at sun.invoke.util.BytecodeDescriptor.parseMethod(BytecodeDescriptor.java:41) at java.lang.invoke.MethodType.fromMethodDescriptorString(MethodType.java:1067) at com.google.devtools.build.android.desugar.LambdaDesugaring$InvokedynamicRewriter.visitInvokeDynamicInsn(LambdaDesugaring.java:406) at org.objectweb.asm.ClassReader.readCode(ClassReader.java:2235) at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1275) at org.objectweb.asm.ClassReader.accept(ClassReader.java:679) at org.objectweb.asm.ClassReader.accept(ClassReader.java:391) at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:618) at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:449) at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:391) at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:974) Caused by: java.lang.ClassNotFoundException: Class kotlin.jvm.functions.Function1 not found at com.google.devtools.build.android.desugar.io.HeaderClassLoader.findClass(HeaderClassLoader.java:53) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at sun.invoke.util.BytecodeDescriptor.parseSig(BytecodeDescriptor.java:83) ... 12 more 1 Logs with Java11 Spoiler Code: extract merge desugar WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.google.devtools.build.android.desugar.Desugar (file:/D:/Basic4android3/Desugar_deploy.jar) to field java.lang.invoke.InnerClassLambdaMetafactory.dumper WARNING: Please consider reporting this to the maintainers of com.google.devtools.build.android.desugar.Desugar WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release Exception in thread "main" java.lang.NullPointerException: Failed to register lambda dump directory 'C:\Users\MANFRE~1\AppData\Local\Temp\lambdas15488322250951725317' at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:980) at com.google.devtools.build.android.desugar.Desugar.verifyLambdaDumpDirectoryRegistered(Desugar.java:983) at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:968) 1 As a side note, I've run jdeps to find the dependencies of the merged.jar from one of the aar files. Not sure how they affect the desugar process. These dependencies, besides the ones that are in the same jar, are: from classes of the other aar, also kotlin, bouncycastle and a couple more. Can anyone shed some light according to this new info? In case these dependencies (Kotlin and/or others) are needed for the desugar process, how can they be added? I hope that the question makes sense. Upvote 0
Thanks to @DonManfred's help, who ran the desugar process with different Java versions, now we have a 'less cryptic' log. Still doesn't work, but hopefully give some useful info Logs with Java 8.202 Spoiler Code: extract merge desugar Exception in thread "main" java.lang.TypeNotPresentException: Type kotlin.jvm.functions.Function1 not present at sun.invoke.util.BytecodeDescriptor.parseSig(BytecodeDescriptor.java:85) at sun.invoke.util.BytecodeDescriptor.parseMethod(BytecodeDescriptor.java:63) at sun.invoke.util.BytecodeDescriptor.parseMethod(BytecodeDescriptor.java:41) at java.lang.invoke.MethodType.fromMethodDescriptorString(MethodType.java:1067) at com.google.devtools.build.android.desugar.LambdaDesugaring$InvokedynamicRewriter.visitInvokeDynamicInsn(LambdaDesugaring.java:406) at org.objectweb.asm.ClassReader.readCode(ClassReader.java:2235) at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1275) at org.objectweb.asm.ClassReader.accept(ClassReader.java:679) at org.objectweb.asm.ClassReader.accept(ClassReader.java:391) at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:618) at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:449) at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:391) at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:974) Caused by: java.lang.ClassNotFoundException: Class kotlin.jvm.functions.Function1 not found at com.google.devtools.build.android.desugar.io.HeaderClassLoader.findClass(HeaderClassLoader.java:53) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at sun.invoke.util.BytecodeDescriptor.parseSig(BytecodeDescriptor.java:83) ... 12 more 1 Logs with Java11 Spoiler Code: extract merge desugar WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.google.devtools.build.android.desugar.Desugar (file:/D:/Basic4android3/Desugar_deploy.jar) to field java.lang.invoke.InnerClassLambdaMetafactory.dumper WARNING: Please consider reporting this to the maintainers of com.google.devtools.build.android.desugar.Desugar WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release Exception in thread "main" java.lang.NullPointerException: Failed to register lambda dump directory 'C:\Users\MANFRE~1\AppData\Local\Temp\lambdas15488322250951725317' at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:980) at com.google.devtools.build.android.desugar.Desugar.verifyLambdaDumpDirectoryRegistered(Desugar.java:983) at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:968) 1 As a side note, I've run jdeps to find the dependencies of the merged.jar from one of the aar files. Not sure how they affect the desugar process. These dependencies, besides the ones that are in the same jar, are: from classes of the other aar, also kotlin, bouncycastle and a couple more. Can anyone shed some light according to this new info? In case these dependencies (Kotlin and/or others) are needed for the desugar process, how can they be added? I hope that the question makes sense.
DonManfred Expert Licensed User Longtime User Feb 12, 2020 #7 New infos. 1. I´m at Home now and tried it here. 2. I added B4X: Private kotlin As String = "E:\Desugar\kotlin-stdlib-1.3.41.jar" Private kotlin2 As String = "E:\Desugar\kotlin-stdlib-jdk8-1.3.41.jar" to the desugar process B4X: Sub Desugar Log("desugar") Run(javaExe, Array("-jar", DesugarJar, _ "--bootclasspath_entry=" & AndroidJar, _ "--bootclasspath_entry=" & kotlin, _ "--bootclasspath_entry=" & kotlin2, _ "--input=Merged.jar", "--output=../Converted.jar")) End Sub 946594800000 extract merge desugar Remove classes.jar Removing from: mobilekeys-android-sdk-release-7.3.1.aar Removing from: origo-sdk-release-1.4.1.aar Done! Click to expand... I´ve updated your drive folder with the result Make sure to download (and use) the updated AARs from your Drive folder.... Last edited: Feb 12, 2020 Upvote 0
New infos. 1. I´m at Home now and tried it here. 2. I added B4X: Private kotlin As String = "E:\Desugar\kotlin-stdlib-1.3.41.jar" Private kotlin2 As String = "E:\Desugar\kotlin-stdlib-jdk8-1.3.41.jar" to the desugar process B4X: Sub Desugar Log("desugar") Run(javaExe, Array("-jar", DesugarJar, _ "--bootclasspath_entry=" & AndroidJar, _ "--bootclasspath_entry=" & kotlin, _ "--bootclasspath_entry=" & kotlin2, _ "--input=Merged.jar", "--output=../Converted.jar")) End Sub 946594800000 extract merge desugar Remove classes.jar Removing from: mobilekeys-android-sdk-release-7.3.1.aar Removing from: origo-sdk-release-1.4.1.aar Done! Click to expand... I´ve updated your drive folder with the result Make sure to download (and use) the updated AARs from your Drive folder....
JordiCP Expert Licensed User Longtime User Feb 12, 2020 #8 No words!! This was driving me nuts, will be able to test it later. A big thanks ) Upvote 0
DonManfred Expert Licensed User Longtime User Feb 12, 2020 #9 JordiCP said: A big thanks ) Click to expand... You are welcome. Greetings to @iCAB as i did not took the Job because i feared it to be too complicated. I´m glad i could help! Upvote 0
JordiCP said: A big thanks ) Click to expand... You are welcome. Greetings to @iCAB as i did not took the Job because i feared it to be too complicated. I´m glad i could help!
DonManfred Expert Licensed User Longtime User Feb 13, 2020 #10 JordiCP said: will be able to test it later Click to expand... What´s the result? Upvote 0
JordiCP Expert Licensed User Longtime User Feb 13, 2020 #11 DonManfred said: What´s the result? Click to expand... Totally positive, it compiled perfectly!! Must check many things yet, as accessing the classes and implementing protocols, but the first obstacle was sorted. Thanks again. Upvote 0
DonManfred said: What´s the result? Click to expand... Totally positive, it compiled perfectly!! Must check many things yet, as accessing the classes and implementing protocols, but the first obstacle was sorted. Thanks again.