arnesson / cordova-plugin-firebase

Cordova plugin for Google Firebase
http://arnesson.github.io/cordova-plugin-firebase
MIT License
1.01k stars 1.56k forks source link

FireBase 2.0.1 causing Dex: Error converting bytecode to dex #1038

Open newuser44 opened 5 years ago

newuser44 commented 5 years ago

Describe the bug

After a successful android build add in FireBase 2.0.1 get error building android.

To Reproduce Steps to reproduce the behavior:

Have the following plugins installed config.xml

<engine name="android" spec="~6.3.0" />
    <engine name="ios" spec="4.5.5" />
    <plugin name="branch-cordova-sdk" spec="^2.5.0" />
    <plugin name="cordova-android-support-gradle-release" spec="~2.1.0">
        <variable name="ANDROID_SUPPORT_VERSION" value="27.+" />
    </plugin>
    <plugin name="cordova-plugin-android-fingerprint-auth" spec="^1.4.3" />
    <plugin name="cordova-plugin-device" spec="^1.1.7" />
    <plugin name="cordova-plugin-file" spec="^6.0.1" />
    <plugin name="cordova-plugin-file-opener2" spec="~2.0.19" />
    <plugin name="cordova-plugin-geolocation" spec="^4.0.1" />
    <plugin name="cordova-plugin-ios-keychain" spec="^3.0.1" />
    <plugin name="cordova-plugin-nativestorage" spec="^2.3.2" />
    <plugin name="cordova-plugin-network-information" spec="^2.0.1" />
    <plugin name="cordova-plugin-splashscreen" spec="^5.0.2" />
    <plugin name="cordova-plugin-statusbar" spec="^2.4.1" />
    <plugin name="cordova-plugin-touch-id" spec="^3.3.1">
        <variable name="FACEID_USAGE_DESCRIPTION" value=" " />
    </plugin>
    <plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
    <plugin name="cordova-plugin-x-socialsharing" spec="~5.4.1">
        <variable name="ANDROID_SUPPORT_V4_VERSION" value="27.+" />
    </plugin>
    <plugin name="ionic-plugin-keyboard" spec="^2.2.1" />

I am able to do an Android build ionic cordova build android Build completes successfully.

Add just this cordova firebase plugin but version 2.0.1 we had installed before. ionic cordova plugin add cordova-plugin-firebase@2.0.1

This installs fine.

Do an android build. ionic cordova build android

Get the error

:compileDebugNdk UP-TO-DATE :compileDebugSources :transformClassesWithDexForDebug Dex: Error converting bytecode to dex: Cause: Dex cannot parse version 52 byte code. This is caused by library dependencies that have been compiled using Java 8 or above. If you are using the 'java' gradle plugin in a library submodule add targetCompatibility = '1.7' sourceCompatibility = '1.7' to that submodule's build.gradle file. UNEXPECTED TOP-LEVEL EXCEPTION: java.lang.RuntimeException: Exception parsing classes at com.android.dx.command.dexer.Main.processClass(Main.java:775) at com.android.dx.command.dexer.Main.processFileBytes(Main.java:741) at com.android.dx.command.dexer.Main.access$1200(Main.java:88) at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1683) at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284) at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166) at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144) at com.android.dx.command.dexer.Main.processOne(Main.java:695) at com.android.dx.command.dexer.Main.processAllFiles(Main.java:592) at com.android.dx.command.dexer.Main.runMonoDex(Main.java:321) at com.android.dx.command.dexer.Main.run(Main.java:292) at com.android.builder.internal.compiler.DexWrapper.run(DexWrapper.java:54) at com.android.builder.core.DexByteCodeConverter.lambda$dexInProcess$0(DexByteCodeConverter.java:173) at com.android.builder.core.DexByteCodeConverter$$Lambda$319/2078225109.call(Unknown Source) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000) at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:476) at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406) at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388) at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251) at com.android.dx.command.dexer.Main.parseClass(Main.java:787) at com.android.dx.command.dexer.Main.access$1600(Main.java:88) at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1722) at com.android.dx.command.dexer.Main.processClass(Main.java:773) ... 17 more

1 error; aborting FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':transformClassesWithDexForDebug'.

    com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Return code 1 for dex process

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

NOTE- Hard to do a clean uninstall of this plugin. Anytime I run ionic cordova plugin remove cordova-plugin-firebase The android folder ends up getting deleted all together. Because of this the remove process errors out before it can finish removing everything. I then have to manually remove any trace from the following.

Removed plugin Remove Android Search For Firebase in folders. Clean up from Config.xml Clean up Fetch.json -- Remember to remove last } (Package.json seems to get cleaned up sometimes). Had to delete what was in the app plugin folder. I think I deleted the nod_module version too.

After all of this I add android 6.3 back and am able to build again.

Expected behavior Using Plugin version 2.0.1 should build fine with android 6.3.

Plugin Version branch-cordova-sdk 2.6.24 "branch-cordova-sdk" cordova-android-support-gradle-release 2.1.0 "cordova-android-support-gradle-release" cordova-plugin-android-fingerprint-auth 1.5.0 "FingerprintAuth" cordova-plugin-device 1.1.7 "Device" cordova-plugin-file 6.0.1 "File" cordova-plugin-file-opener2 2.0.19 "File Opener2" cordova-plugin-firebase 2.0.1 "Google Firebase Plugin" cordova-plugin-geolocation 4.0.1 "Geolocation" cordova-plugin-ios-keychain 3.0.1 "KeyChain Plugin for Cordova iOS" cordova-plugin-nativestorage 2.3.2 "NativeStorage" cordova-plugin-network-information 2.0.1 "Network Information" cordova-plugin-splashscreen 5.0.2 "Splashscreen" cordova-plugin-statusbar 2.4.2 "StatusBar" cordova-plugin-touch-id 3.3.1 "Touch ID" cordova-plugin-whitelist 1.3.3 "Whitelist" cordova-plugin-x-socialsharing 5.4.1 "SocialSharing" es6-promise-plugin 4.2.2 "Promise" ionic-plugin-keyboard 2.2.1 "Keyboard"

Desktop (please complete the following information): Building in Linux Mint 16?

Additional context

newuser44 commented 5 years ago

Tried removing firebase and support gradle release plugin. Install firebase first, then gradle release plugin. Still same error

Delete Firebase (and all the extra steps) and Android 6.3. Install android 6.4 I build and it builds fine.
Add Firebase again.
Get this problem. (At the time I don't think I realized it was tied to firebase plugin). https://forum.ionicframework.com/t/upgrade-android-6-3-to-6-4/152948