Android build problem - transformClassesWithDesugarForDebug
najafi-saeed opened this issue · 9 comments
After I install batch Cordova plugin to my ionic app, I can't build android. When I run ionic cordova run android
it shows this errors:
:app:transformClassesWithDesugarForDebug FAILED
35 actionable tasks: 1 executed, 34 up-to-date
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:transformClassesWithDesugarForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.google.devtools.build.android.desugar.Desugar with arguments {
--input C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\32.jar
--output C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\desugar\debug\29.jar
--input C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\17.jar
--output C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\desugar\debug\16.jar
--input C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\35.jar
--output C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\desugar\debug\32.jar
--input C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\11.jar
--output C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\desugar\debug\10.jar
--input C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\39.jar
--output C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\desugar\debug\36.jar
--input C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\33.jar
--output C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\desugar\debug\30.jar
--input C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\20.jar
--output C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\desugar\debug\19.jar
--input C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\0.jar
--output C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\desugar\debug\2.jar --input C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\30.jar
--output C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\desugar\debug\27.jar
--input C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\36.jar --output C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\desugar\debug\33.jar --input C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\6.jar --output C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\desugar\debug\7.jar --input C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\classes\debug --output C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\desugar\debug\1 --input C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\23.jar --output C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\desugar\debug\21.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\CordovaLib\build\intermediates\intermediate-jars\debug\classes.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\classes\debug --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\0.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\1.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\3.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\4.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\5.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\6.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\7.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\8.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\11.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\12.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\13.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\14.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\15.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\16.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\17.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\18.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\19.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\20.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\22.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\23.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\24.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\25.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\26.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\27.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\28.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\30.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\31.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\32.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\33.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\34.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\35.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\36.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\37.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\38.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\39.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\40.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\43.jar --classpath_entry C:\Users\Saeed\repos\0ccrs\platforms\android\app\build\intermediates\transforms\stackFramesFixer\debug\44.jar --bootclasspath_entry C:\Users\Saeed\AppData\Local\Android\android-sdk\platforms\android-27\android.jar --bootclasspath_entry C:\Users\Saeed\AppData\Local\Android\android-sdk\platforms\android-27\optional\org.apache.http.legacy.jar --bootclasspath_entry C:\Program Files\Java\jdk1.8.0_152\jre\lib\resources.jar --bootclasspath_entry C:\Program Files\Java\jdk1.8.0_152\jre\lib\rt.jar --bootclasspath_entry C:\Program Files\Java\jdk1.8.0_152\jre\lib\jsse.jar --bootclasspath_entry C:\Program Files\Java\jdk1.8.0_152\jre\lib\jce.jar --bootclasspath_entry C:\Program Files\Java\jdk1.8.0_152\jre\lib\charsets.jar --bootclasspath_entry C:\Program Files\Java\jdk1.8.0_152\jre\lib\jfr.jar --min_sdk_version 19 --nodesugar_try_with_resources_if_needed --desugar_try_with_resources_omit_runtime_classes}
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 21s
cmd: Command failed with exit code 1 Error output:
Exception in thread "main" java.lang.IllegalArgumentException
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:108)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer$DefaultMethodFinder.visit(DefaultMethodClassFixer.java:471)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.defaultMethodsDefined(DefaultMethodClassFixer.java:319)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.visitEnd(DefaultMethodClassFixer.java:88)
at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
at com.google.devtools.build.android.desugar.InterfaceDesugaring.visitEnd(InterfaceDesugaring.java:85)
at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
at com.google.devtools.build.android.desugar.LambdaDesugaring.visitEnd(LambdaDesugaring.java:150)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:401)
at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:326)
at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:280)
at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:584)
FAILURE: Build failed with an exception.
It's worked until yesterday and I built it several time. but today it did not work by itself!
I searched but I could not resolve problem. I understand that the problem can be two things interacting or conflict. one of them can be implementation "com.google.android.gms:play-services-ads-identifier:+"
in batch.gradle
file.
I don't have any idea! please help me.
my versions:
ionic (Ionic CLI) : 4.6.0
cordova (Cordova CLI) : 8.1.2
Cordova Platforms : android 7.1.4, ios 4.5.5
Android SDK Tools : 25.2.3
NodeJS : v6.9.5
npm : 3.10.10
How I can do?
Hello,
Did you try cleaning the build using cordova clean
or by directly going into the the Android platform output folder, and executing gradlew clean
?
Thank you for response
yes, I ran cordova clean android
too but problem doesn't solve.
And I run gradlew clean
now, but it doesn't solve too.
Thanks.
Then it may be because of mismatching versions. It seems to be related to this issue: arnesson/cordova-plugin-firebase#606
Trying https://github.com/dpa99c/cordova-android-play-services-gradle-release may help. Using the latest version of the libraries is what works best for us, but it might be incompatible with some project configurations.
Unfortunately I'm unable to reproduce the problem on my side for now
I install cordova-android-play-services-gradle-release
and app runs to mobile. but when I open the app show an error and close it: Unfortunately myapp has stopped!
How to figure out what versions are mismatching? and How solve it manual?
You need to look at your logcat to see why your app is crashing.
How to figure out what versions are mismatching?
Unfortunately, I can't know that as it depends on which plugin you're using.
How solve it manual?
Unless I can reproduce this locally, I don't have an answer for you. It is also possible that this problem isn't caused directly by Batch, but rather by an interaction of multiple plugins.
You could always try installing cordova-plugin-firebase and open your local copy of batch.gradle https://github.com/BatchLabs/cordova-plugin/blob/master/dist/src/android/batch.gradle#L9-L15 and remove the lights I highlighted
I use only default ionic plugins. my plugin list is this:
cordova plugin ls:
com.batch.cordova 2.2.0 "Batch"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 2.3.1 "cordova-plugin-ionic-webview"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
I even installed a blank ionic and then I added batch to it. It had the same problem too.
we coded back-end codes based on batch. Everything worked right until yesterday. I should solve this problem. please help me. I am sorry for my bad English writing too. I am not native in English.
I removed your highlighted from batch.gradle and then I installed cordova-plugin-firebase plugin.
I run the app. It says:
- The library
com.google.android.gms:play-services-basement
is being requested by various other libraries at [[11.0.4,11.0.4]], but resolves to 16.1.0. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies. - The library
com.google.firebase:firebase-common
is being requested by various other libraries at [[11.0.4,11.0.4]], but resolves to 16.0.3. Disable the plugin and ...
How I solve version issue?
Did you get a chance to look at the logcat for the crashing app?
I'll look into it later, but it's possible some stuff changed in the repos too. Wouldn't be the first time something breaks there
Finally I solved this problem. I installed this plugins:
cordova-android-play-services-gradle-release (with default version: 15.+)
cordova-android-firebase-gradle-release (with version 11.0.4)
and clean cordova
thank you @abarisain 👍
Finally I solved this problem. I installed this plugins:
cordova-android-play-services-gradle-release (with default version: 15.+)
cordova-android-firebase-gradle-release (with version 11.0.4)
andclean cordova
thank you @abarisain 👍
OMG i want to cry for happiness! It help me to solve the problem, i spent like 10 hours trying to solve this and now finally i found the solution. Thank you so much for share!!