androidcordovacordova-pluginssmooch

Build exception with cordova-plugin-smooch


I'm trying to integrate smooch into my Cordova app with the official plugin but when I go to build my application it throws a main thread exception back at me. Here's (what I think are the relevant parts of) my build output, if you need any more just comment and I'll put it up.

:app:transformClassesWithDesugarForDebugException 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.ClassVisitor.visitEnd(Unknown Source)
at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
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)

The rest is at: https://pastebin.com/9j0ZW7rJ

I've followed the Android installation instructions, changed my app-id and all of that guff... I'm not sure but I have a hunch it might be conflicting with https://github.com/arnesson/cordova-plugin-firebase since they both handle fcm messages and I've had problems like that before.

Here are the other plugins in my app:

cordova-plugin-firebase 0.1.25 "Google Firebase Plugin"
cordova-plugin-headercolor 1.0 "HeaderColor"
cordova-plugin-statusbar 2.4.1 "StatusBar"

If anyone has any ideas for what to try, has had this problem before and knows what's going on, I'd love your help! There's an issue over on github but not sure if smooch is maintaining the plugin anymore.


Solution

  • It's not a Cordova specific issue at all, thanks to wmora for pointing me towards dependencies.

    First, run gradlew myapp:dependencies inside your app (for cordova projects, this is /platforms/android) and make sure that all of your dependencies match up correctly.

    If not, head over to /platforms/android/app/build.gradle and down to dependencies and add the dependency along with an explicit version number.

    (This is what I needed, might not work for you)

    compile "com.google.firebase:firebase-auth:11.8.0"
    compile "com.google.android.gms:play-services-location:11.8.0"
    

    (for cordova projects, outside it after the last quote inside your dependency brackets to make sure cordova doesn't overwrite it)

    Clean, build and hopefully you should be good to go!