B4J Question Desugar problem

sadeq.hitex

Member
Licensed User
Im trying to desugar an aar library to fix this problem :

B4X:
Uncaught translation error: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Translation has been interrupted
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:692)
    at com.android.dx.command.dexer.Main.runMultiDex(Main.java:366)
    at com.android.dx.command.dexer.Main.runDx(Main.java:291)
    at com.android.dx.command.dexer.Main.main(Main.java:249)
    at com.android.dx.command.Main.main(Main.java:94)
Caused by: java.lang.InterruptedException: Too many errors
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:684)
    ... 4 more


I put the 'aar' file in the folder where that 'Desugar_deploy.jar' is located.

the error is :
B4X:
extract
merge
desugar
Exception in thread "main" java.lang.IllegalStateException: Expected a load for Lcom/batch/android/BatchTagCollectionsFetchListener; to set up parameter 2 for com/batch/android/a0$$Lambda$0 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)
    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)
1

temp folder and merged.jar created successfully , but errors not fixed.
 

sadeq.hitex

Member
Licensed User
Yes its Android library.

I thought I should use B4J code :
Screenshot (422).png


How should I use command line ?
 
Upvote 0

sadeq.hitex

Member
Licensed User
Thank you for your response , i used command line
B4X:
java -jar Desugar_deploy.jar --bootclasspath_entry="E:\Android\android\platforms\android-28\android.jar" --input=classes.jar --output=batch.jar

but same error in cmd :
1614158732740.png

B4X:
Exception in thread "main" java.lang.IllegalStateException: Expected a load for Lcom/batch/android/BatchTagCollectionsFetchListener; to set up parameter 2 for com/batch/android/a0$$Lambda$0 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)
        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)

Error is about the lambda
How can I fix it?
 
Upvote 0
Top