arnesson / cordova-plugin-firebase

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

version 1.0.5 no longer allows an android build #933

Open Zvika88 opened 5 years ago

Zvika88 commented 5 years ago

Describe the bug My Cordova app uses a frozen version of the Firebase plugin 1.0.5 . All other plugins and libraries are also frozen to a specific working version. However it stopped working. something in version 1.0.5 changed. If I remove the firebase plugin the build succeeds. If I add it back then build fails.

To Reproduce Steps to reproduce the behavior:

  1. build any cordova app that specifically uses the plugin in version 1.0.5
  2. "cordova build android" will produce the following error:

:transformClassesWithDexForDebugDex: 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)

Expected behavior It should not show any such error, the build should have been completed without errors.

Screenshots screen shot 2018-10-31 at 4 26 00 pm

Console Logs n/a

Plugin Version 1.0.5

Desktop (please complete the following information):

Smartphone (please complete the following information): n/a

Additional context java -version java version "1.8.0_101" Java(TM) SE Runtime Environment (build 1.8.0_101-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

Android target SDK: 26 cordova platform add android@6.3.0 Cordova version: 6.5.0

matthew-valenti commented 5 years ago

We've also suddenly encountered build issues version 1.0.5 (android only since 10/26/2018). After trying many different things the only thing that worked for us was to upgrade cordova-plugin-firebase to the latest version 2.0.5. We use IonicPro to build our projects. Changing the following in config.xml resulted in successful android and ios builds.

Change: <plugin name="cordova-plugin-firebase" spec="1.0.5" /> To: <plugin name="cordova-plugin-firebase" spec="2.0.5" />

Note that we still need to do final QA to ensure plugin features are all working correctly but at least we can build again.

jetwitaussi commented 5 years ago

To use firebase plugin version 2.0.5 you need to use cordova-android@6.4.0 at least or you will have others errors And probably set multidex too

tmk1991 commented 5 years ago

Same issue. I've tried the cordova-plugin-enable-multidex plugin and no luck. End up getting: `Execution failed for task ':app:transformClassesWithJarMergingForRelease'.

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/measurement/zzdz.class`


Can't upgrade my firebase SDK to 5+ due to conflicts with other major packages (Angular, rxjs, Ionic 3.8, Angularfire2, etc.) Unable to build by project to make the latest release to users. @matthew-valenti was the sdk an issue?


@Zvika88 did you come up with a solution?


@soumak77 I think you're the main POC for this plugin. Any changes made recently that would cause this?

Thanks!

Zvika88 commented 5 years ago

For the information of anyone else having these issues: I switched to version 1.1.4, seems to be compatible with the 1.0.5 as far as my use but not having the problems inflicted on 1.0.5 .

Something got corrupted or changed in 1.0.5 or any of its dependencies but having a working solution with 1.1.4 is good enough for now.

rhanesoghlyan commented 5 years ago

@Zvika88 I have the same issue with version 1.1.4

tmk1991 commented 5 years ago

You need to upgrade to the latest version.

newuser44 commented 5 years ago

I am also having this problem seems like out of the blue. I'm using Android 6.3 but have had Java 8 installed for years. I don't know if its related to this plugin or not. Did we find a fix for this?

Here is the plugins I'm using.

<engine name="android" spec="~6.3.0" />
    <engine name="browser" spec="~4.1.0" />
    <engine name="ios" spec="4.5.5" />
    <plugin name="branch-cordova-sdk" spec="^2.7.1" />
    <plugin name="cordova-android-support-gradle-release" spec="^1.4.4">
        <variable name="ANDROID_SUPPORT_VERSION" value="27.+" />
    </plugin>
    <plugin name="cordova-plugin-android-fingerprint-auth" spec="^1.4.4" />
    <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-firebase" spec="~2.0.1" />
    <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.2" />
    <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" />
    <plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
tmk1991 commented 5 years ago

@newuser44 upgrade to 2.0.5

newuser44 commented 5 years ago

@tmk1991 I'm trying that now. Updated the the plugin to 2.0.5 And Android 6.4
But I get a new error
Could not get unknown property 'ANDROID_SUPPORT_V4_VERSION' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

The cycle continues. Trying to figure out how to solve that.

tmk1991 commented 5 years ago

Make sure you completely remove and add the plugin. There are flags that sometimes get pulled into plugins for things like that.

newuser44 commented 5 years ago

Ran

cordova plugin remove cordova-plugin-firebase --save cordova-android-support-gradle-release: removed Gradle config file: platforms/android/cordova-android-support-gradle-release/properties.gradle cordova-android-support-gradle-release: removed Gradle config file: platforms/android/app/cordova-android-support-gradle-release/properties.gradle Uninstalling cordova-plugin-firebase from android

Error during processing of action! Attempting to revert...

Error: Uh oh! AndroidStudio.js:inAndroidStudioProject root does not exist: /home/user/dev/Ionic-App/apps/NewApp/platforms/android [ERROR] An error occurred while running cordova plugin remove cordova-plugin-firebase --save (exit code 1).

--When I remove the plugin it seems to delete more files then it should.

cordova platform remove android --save Removing platform android from config.xml file...

Removing android from cordova.platforms array in package.json

It was suggest to setup a test version of Analytics on google. so com.app.name.test is what was setup. Not sure if this is a problem but when the plugin is installed it pulls from this name. So android/cordova-plugin-firebase/ appname-build.gradle will get test-build.gradle if app name in config.xml ends with .test. I have to remember to remove that before any of this.

Delete the plugins folder for the app to make sure its downloading.
Updated config.xml and package.json to use 2.0.5 version of the plugin.

Ran: ionic cordova platform add android@6.4 Let it download the plugins again.
--- Discovered plugin "cordova-plugin-firebase" in config.xml. Adding it to the project Installing "cordova-plugin-firebase" for android Subproject Path: CordovaLib Installing "cordova-plugin-firebase" for browser Adding cordova-plugin-firebase to package.json Saved plugin info for "cordova-plugin-firebase" to config.xml

Run ionic cordova build android -debug

Get the same error. --

Must be another plugin, but which one? Thanks for the help.

newuser44 commented 5 years ago

New Config.xml

<engine name="android" spec="~6.4.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="^1.4.4">
        <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">
        <variable name="ANDROID_SUPPORT_V4_VERSION" value="27.+" />
    </plugin>
    <plugin name="cordova-plugin-firebase" spec="~2.0.5" />
    <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="24.1.1+" />
    </plugin>
    <plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
tmk1991 commented 5 years ago

This seems unrelated to this plugin. See your file-opener2 plugin ANDROID_SUPPORT_V4_VERSION or your support gradle release plugin or your socialsharing plugin

newuser44 commented 5 years ago

Yeah new side effect of going up to Android 6.4 I assume. I removed and added all three those plugins. Got an update except for socialsharing.

<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.2.0">
        <variable name="ANDROID_SUPPORT_V4_VERSION" value="27.+" />
    </plugin>
    <plugin name="cordova-plugin-firebase" spec="~2.0.5" />
    <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.4">
        <variable name="ANDROID_SUPPORT_V4_VERSION" value="24.1.1+" />
    </plugin>
    <plugin name="ionic-plugin-keyboard" spec="^2.2.1" />

For cordova-android-support-gradle-release can't get that value to use ANDROID_SUPPORT_V4_VERSION. Added it with the other value. Added it alone. Didn't seem to change anything.

For socialSharing still has value 24.1.1. tried to Change it to 27.+ It just gets changed back.
Stuck down a path.