cordova-plugin-firebase: New error on android build since 06-05-2019

Describe the bug Were having a new error on cordova build android since about 3 hours ago (06-05-2019 16:00:00). On a same build that passed this noon…

To Reproduce Steps to reproduce the behavior: Using these depency :

“dependencies”: { “@vimeo/player”: “^2.8.2”, “android-versions”: “^1.4.0”, “autoprefixer”: “^9.5.1”, “aws-sdk”: “^2.446.0”, “browser-sync”: “^2.26.4”, “cordova-browser”: “^6.0.0”, “cordova-ios”: “^5.0.1”, “cordova-plugin-app-version”: “^0.1.9”, “cordova-plugin-customconfigparameters”: “^3.0.0”, “cordova-plugin-device”: “^2.0.2”, “cordova-plugin-file”: “^6.0.1”, “cordova-plugin-file-downloader”: “^0.4.0”, “cordova-plugin-file-md5”: “^0.3.3”, “cordova-plugin-file-transfer”: “^1.7.1”, “cordova-plugin-firebase”: “git+https://github.com/arnesson/cordova-plugin-firebase.git”, “cordova-plugin-inappbrowser”: “^3.0.0”, “cordova-plugin-network-information”: “^2.0.1”, “cordova-plugin-splashscreen”: “git+https://github.com/apache/cordova-plugin-splashscreen.git”, “cordova-plugin-statusbar”: “git+https://github.com/apache/cordova-plugin-statusbar.git”, “cordova-plugin-streaming-media”: “^2.2.0”, “cordova-plugin-whitelist”: “^1.3.3”, “cordova-plugin-zip”: “^3.1.0”, “cordova-support-google-services”: “^1.1.0”, “del”: “^4.1.0”, “express”: “^4.16.4”, “gameanalytics”: “^3.1.2”, “graceful-fs”: “^4.1.15”, “gulp-concat”: “^2.6.1”, “gulp-copy”: “^4.0.1”, “gulp-eslint”: “^5.0.0”, “gulp-install”: “^1.1.0”, “gulp-kit”: “^0.3.0”, “gulp-postcss”: “^8.0.0”, “gulp-rename”: “^1.4.0”, “gulp-sass”: “^4.0.2”, “gulp-sourcemaps”: “^2.6.5”, “gulp-uglify”: “^3.0.2”, “nativescript-gameanalytics”: “^2.1.2”, “node-properties-parser”: “0.0.2”, “phonegap-plugin-multidex”: “^1.0.0”, “properties-parser”: “^0.3.1”, “sqli-cordova-disk-space-plugin”: “~1.0.2”, “vimeo”: “^2.1.1” },

Run Cordova build android and we get an error.

**Console Logs**
Task :app:compileReleaseJavaWithJavac
/builds/MGAEntertainment/lol-video-star/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePluginInstanceIDService.java:6: error: cannot find symbol
import com.google.firebase.iid.FirebaseInstanceIdService;
                              ^
  symbol:   class FirebaseInstanceIdService
  location: package com.google.firebase.iid
/builds/MGAEntertainment/lol-video-star/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePluginInstanceIDService.java:8: error: cannot find symbol
public class FirebasePluginInstanceIDService extends FirebaseInstanceIdService {
                                                     ^
  symbol: class FirebaseInstanceIdService
/builds/MGAEntertainment/lol-video-star/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePlugin.java:610: error: method getByteArray in class FirebaseRemoteConfig cannot be applied to given types;
                        : FirebaseRemoteConfig.getInstance().getByteArray(key, namespace);
                                                            ^
  required: String
  found: String,String
  reason: actual and formal argument lists differ in length
/builds/MGAEntertainment/lol-video-star/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePlugin.java:629: error: method getValue in class FirebaseRemoteConfig cannot be applied to given types;
                        : FirebaseRemoteConfig.getInstance().getValue(key, namespace);
                                                            ^
  required: String
  found: String,String
  reason: actual and formal argument lists differ in length
/builds/MGAEntertainment/lol-video-star/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePlugin.java:686: error: no suitable method found for setDefaults(Map<String,Object>,String)
                        FirebaseRemoteConfig.getInstance().setDefaults(defaultsToMap(defaults), namespace);
                                                          ^
    method FirebaseRemoteConfig.setDefaults(Map<String,Object>) is not applicable
      (actual and formal argument lists differ in length)
    method FirebaseRemoteConfig.setDefaults(int) is not applicable
      (actual and formal argument lists differ in length)
/builds/MGAEntertainment/lol-video-star/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePlugin.java:885: error: cannot find symbol
                        myTrace.incrementCounter(counterNamed);
                               ^
  symbol:   method incrementCounter(String)
  location: variable myTrace of type Trace
/builds/MGAEntertainment/lol-video-star/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePluginInstanceIDService.java:17: error: method does not override or implement a method from a supertype
    @Override
    ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
7 errors

FAILURE: Build failed with an exception.

Desktop (please complete the following information):

  • OS: Android
  • Version API 28 Revision 6

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 105
  • Comments: 209 (10 by maintainers)

Commits related to this issue

Most upvoted comments

This is due to the firebase updates on April 05. Here https://firebase.google.com/support/release-notes/android#update_-_april_02_2019, I found the last working versions and adjusted my project.properties accordingly like so

cordova.system.library.4=com.google.firebase:firebase-core:16.0.8 cordova.system.library.5=com.google.firebase:firebase-messaging:17.5.0 cordova.system.library.6=com.google.firebase:firebase-config:16.4.1 cordova.system.library.7=com.google.firebase:firebase-perf:16.2.4

Here all dependencies are locked to the specific version (Update - April 02, 2019) instead of +, which would get you the latest version thus breaking the build process.

Now I can build successfully! Hope it helps!

We can change gradle dependencies without forking project using gradle scripting. check “build-extras.gradle” docs https://cordova.apache.org/docs/en/latest/guide/platforms/android/#extending-buildgradle

build-extras.gradle

def dependencyMap = [
       "com.google.firebase:firebase-core" : "16.0.8",
        "com.google.firebase:firebase-perf": "16.2.4",
        "com.google.firebase:firebase-messaging": "17.5.0",
        "com.google.firebase:firebase-config": "16.4.1",
        "com.google.firebase:firebase-iid": "17.1.1",
        "com.google.firebase:firebase-auth": "16.2.0",
        "com.google.android.gms:play-services-tagmanager": "16.0.8"
]

allprojects {
    repositories {
            google()
            jcenter()
            mavenLocal()
    }

    configurations.all {

        resolutionStrategy {

            eachDependency { DependencyResolveDetails details ->
                def group = details.requested.group
                def name = details.requested.name
                def fullName =  group + ":" + name
                print fullName
                if (dependencyMap.containsKey(fullName)) {
                    details.useVersion dependencyMap[fullName]
                }
            }
        }
    }

}

copy_build_extra.js

#!/usr/bin/env node

const fs = require('fs')

fs.copyFileSync("./build-extras.gradle", "./platforms/android/build-extras.gradle");

add new hook to config.xml’s <android> tag. https://cordova.apache.org/docs/en/9.x/guide/appdev/hooks/index.html#page-toc-source

 <hook type="before_build" src="copy_build_extra.js" />

updated 17.07.2019

added new packages https://github.com/arnesson/cordova-plugin-firebase/issues/1057#issuecomment-512240127

Using ionic v1 you can update:

plugins/cordova-plugin-firebase/plugin.xml

<framework src="com.google.android.gms:play-services-tagmanager:15.+" />
<framework src="com.google.firebase:firebase-core:15.+" />
<framework src="com.google.firebase:firebase-messaging:15.+" />
<framework src="com.google.firebase:firebase-config:15.+" />
<framework src="com.google.firebase:firebase-perf:15.+" />

(add “15.” before “+”)

and file plugins/cordova-plugin-firebase/src/android/build.gradle

compile 'com.google.firebase:firebase-auth:15.+'

(same add “15.” before “+”)

then remove android platform and readd it

i’m not convinced it’s the best fix so i won’t do a PR, but at least it fixes the problem for now, hope it helps!

I’ve created PR #1058 to fix this by updating the plugin code to remove/replace references to deprecated API features that were removed in the April 05 Firebase SDK release.

Until such time as it has been merged, you can install the fixed plugin directly off my fork:

cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue

the solution is to don’t use this plugin anymore (as is not maintened), and replace it with cordova-plugin-firebase-lib (a fork with several fixes):

ionic cordova plugin remove cordova-plugin-firebase
ionic cordova plugin add cordova-plugin-firebase-lib@3.3.0 --save

cordova build failing getting below error The library com.google.firebase:firebase-iid is being requested by various other libraries at [[17.1.1,17.1.1]], but resolves to 19.0.0.

Thanks @fjckls , it worked!! @pluckannfeel you can find it on platforms/android/project.properties

Same here, when trying to build android.

After a search at google I found following answer: https://medium.com/android-school/firebaseinstanceidservice-is-deprecated-50651f17a148

as the FirebaseInstanceIdService deprecated.

The Solution in This Link Worked for me.

  1. Remove cordova-firebase-plugin with ionic cordova plugin remove cordova-firebase-plugin

  2. Install: ionic cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue

  3. rm -rf node_modules/ plugins/ platforms/android package-lock.json

  4. npm install

  5. ionic cordova platform add android

  6. ionic cordova build android

As I mentioned here, if you’re installing into an existing project you may need to remove/re-add the Android platform in order to rebuild the Gradle config after installing the plugin from my fork:

cordova plugin rm cordova-plugin-firebase && cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue
cordova platform rm android --nosave && cordova platform add android --nosave
cordova build android

Using @punksta’s solution I had still this message when building my Ionic app: no resource identifier found for attribute 'appcomponentfactory' in package 'android' Or this one: The library com.google.firebase:firebase-iid is being requested by various other libraries at [[17.1.1,17.1.1]], but resolves to 19.0.0.

I identified new dependencies to set by running ./gradlew ::dependencies in platforms/android/ (or ./gradlew :app:dependencies for non Ionic projects)

Here is the updated build-extras.gradle I came up with:

def dependencyMap = [
        "com.google.firebase:firebase-core" : "16.0.8",
        "com.google.firebase:firebase-perf": "16.2.4",
        "com.google.firebase:firebase-messaging": "17.5.0",
        "com.google.firebase:firebase-config": "16.4.1",
        "com.google.firebase:firebase-iid": "17.1.1",
        "com.google.firebase:firebase-auth": "16.2.0",
        "com.google.android.gms:play-services-tagmanager": "16.0.8"
]

ext.postBuildExtras = {
    configurations.all {
        resolutionStrategy.eachDependency { DependencyResolveDetails details ->
            def group = details.requested.group
            def name = details.requested.name
            def fullName =  group + ":" + name
            if (dependencyMap.containsKey(fullName)) {
                println 'Forcing version ' + dependencyMap[fullName] + ' for ' + fullName
                details.useVersion dependencyMap[fullName]
            }
        }
    }
}

To have more details about how to use this file, please refer to the original solution here

This is due to the firebase updates on April 05. Here https://firebase.google.com/support/release-notes/android#update_-_april_02_2019, I found the last working versions and adjusted my project.properties accordingly like so

cordova.system.library.4=com.google.firebase:firebase-core:16.0.8 cordova.system.library.5=com.google.firebase:firebase-messaging:17.5.0 cordova.system.library.6=com.google.firebase:firebase-config:16.4.1 cordova.system.library.7=com.google.firebase:firebase-perf:16.2.4

Here all dependencies are locked to the specific version (Update - April 02, 2019) instead of +, which would get you the latest version thus breaking the build process.

Now I can build successfully! Hope it helps!

where will you find project.properties

here is the complete step what i did for fixing this issue:

  • removed plugins folder, removed node_modules.
  • also don’t forget to remove package-lock.json file
  • ionic cordova platform rm android -ionic cordova plugin rm cordova-plugin-firebase -ionic cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue
  • ionic cordova platform add android && npm install -ionic cordova plugin add cordova-android-support-gradle-release -ionic cordova build android

Note: If you are using resource file tag inside config.xml for custom notification icons like:

    <!-- Copy the color definition -->
    <resource-file src="res/native/android/res/values/colors.xml" target="app/src/main/res/values/colors.xml"/>
    <!-- Copy the icons -->
    <resource-file src="res/native/android/res/drawable-hdpi/ic_silhouette.png" target="app/src/main/res/drawable-hdpi/ic_silhouette.png"/>
    <resource-file src="res/native/android/res/drawable-xhdpi/ic_silhouette.png" target="app/src/main/res/drawable-xhdpi/ic_silhouette.png"/>
    <resource-file src="res/native/android/res/drawable-xxhdpi/ic_silhouette.png" target="app/src/main/res/drawable-xxhdpi/ic_silhouette.png"/>
    <resource-file src="res/native/android/res/drawable-xxxhdpi/ic_silhouette.png" target="app/src/main/res/drawable-xxxhdpi/ic_silhouette.png"/>

    <!-- Configure Firebase -->
    <config-file parent="/manifest/application" target="AndroidManifest.xml">
        <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/ic_silhouette" />
        <meta-data android:name="com.google.firebase.messaging.default_notification_color" android:resource="@color/primary" />
    </config-file>

then you should first remove these lines of code(ctrl+x) from your config.xml and then only add android platform (do not forget to remove android platform before adding)

  • when android platform is added successfully then you can add (ctrl +v) previously removed resource file tags. finally: => ionic cordova build android build’s like a charm. Thanks.

@sagrawal31 thanks a lot. finally it is working.

simply i am using your old version plugin with latest platform :

ionic cordova plugin add cordova-plugin-firebase-lib@3.3.0 --save

We are now maintaining a fork wizpanda/cordova-plugin-firebase-lib with all these fixes & changes.

Here’s how I’ve fixed it, I’ve tried many of the solutions above, and on other discussions but none of em worked for me.

Follow those steps & 👍

1. I’ve deleted everything ( platform, plugins & package-lock.json, node_modules ).

rm -rf package-lock.json platforms/ plugins/ node_modules/

2. make sure you’ve deleted cordova-plugin-firebase from both, your package.json & config.xml

3. add a fresh platform & install the needed modules

cordova platforms add android && npm install

4. add cordova-android-firebase-gradle-release plugin

cordova plugin add cordova-android-firebase-gradle-release

Now just clean & build, I hope this will help someone out there, as it drove me crazy for hours.

Hi, Replace your cordova-plugin-firebase files - FirebasePlugin.java FirebasePluginMessageReceiver.java FirebasePluginMessageReceiverManager.java OnNotificationOpenReceiver.java

from the below link

https://github.com/dpa99c/cordova-plugin-firebase/tree/143f450894e89ff7d77d31197738386d5bea2a16/src/android

and delete FirebaseInstanceIdService.Java file in folder \platforms\android\app\src\main\java\org\apache\cordova\firebase\

Modifying helper.js file and setting back version 4.1.0 to google-services this error is coming back:

* What went wrong:
The library com.google.android.gms:play-services-measurement-base is being requested by various other libraries at [[16.5.0,16.5.0], [16.4.0,16.4.0]], but resolves to 16.5.0. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.

This is due to the firebase updates on April 05. Here https://firebase.google.com/support/release-notes/android#update_-_april_02_2019, I found the last working versions and adjusted my project.properties accordingly like so

cordova.system.library.4=com.google.firebase:firebase-core:16.0.8 cordova.system.library.5=com.google.firebase:firebase-messaging:17.5.0 cordova.system.library.6=com.google.firebase:firebase-config:16.4.1 cordova.system.library.7=com.google.firebase:firebase-perf:16.2.4

Here all dependencies are locked to the specific version (Update - April 02, 2019) instead of +, which would get you the latest version thus breaking the build process.

Now I can build successfully! Hope it helps!

I succeeded in rewrite platforms/android/app/build.gradle and platforms/android/project.properties by @fjckls’s method.

Here is a quick fix if you guys can’t wait for new plugin update release. https://forum.ionicframework.com/t/ionic-4-cordova-run-android-firebase-error-all-of-a-sudden/163204/23

We can change gradle dependencies without forking project using gradle scripting. check “build-extras.gradle” docs https://cordova.apache.org/docs/en/latest/guide/platforms/android/#extending-buildgradle

build-extras.gradle

def dependencyMap = [
        "com.google.firebase:firebase-core" : "16.0.8",
        "com.google.firebase:firebase-perf": "16.2.4",
        "com.google.firebase:firebase-messaging": "17.5.0",
        "com.google.firebase:firebase-config": "16.4.1"
]

allprojects {
    repositories {
            google()
            jcenter()
            mavenLocal()
    }

    configurations.all {

        resolutionStrategy {

            eachDependency { DependencyResolveDetails details ->
                def group = details.requested.group
                def name = details.requested.name
                def fullName =  group + ":" + name
                print fullName
                if (dependencyMap.containsKey(fullName)) {
                    details.useVersion dependencyMap[fullName]
                }
            }
        }
    }

}

copy_build_extra.js

#!/usr/bin/env node

const fs = require('fs')

fs.copyFileSync("./build-extras.gradle", "./platforms/android/build-extras.gradle");

add new hook to config.xml’s <android> tag. https://cordova.apache.org/docs/en/9.x/guide/appdev/hooks/index.html#page-toc-source

 <hook type="before_build" src="copy_build_extra.js" />

You can use resolutionStrategy.force to force dependencies versions :

configurations.all {
  resolutionStrategy {
    // force certain versions of dependencies (including transitive)
    force "com.google.firebase:firebase-core:16.0.8", "com.google.firebase:firebase-perf:16.2.4", "com.google.firebase:firebase-messaging:17.5.0", "com.google.firebase:firebase-config:16.4.1"
  }
}

Thanks for the tip, it works for me

<framework src="com.google.firebase:firebase-core:16.0.8" />
<framework src="com.google.firebase:firebase-messaging:17.+" />
<framework src="com.google.firebase:firebase-config:16.+" />
<framework src="com.google.firebase:firebase-perf:16.+" />

@charlesRms

But issue with cordova-plugin-firebase plugin. if I removed this then build is successfull but if I added this plugin to my project then getting error

Yup, i thought it was ok because the app was building, but I had lost push notifications capabilities.

Finally fixed this problem using this https://github.com/arnesson/cordova-plugin-firebase/pull/1058

  1. I’ve deleted everything ( platform, plugins & package-lock.json, node_modules ).

rm -rf package-lock.json platforms/ plugins/ node_modules/

  1. make sure you’ve deleted cordova-plugin-firebase from both, your package.json & config.xml

  2. add the forked plugin cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue

  3. add a fresh platform & install the needed modules cordova platforms add android && npm install

Please try not to edit any files from platform/android folder because the moment you remove and add this platform all those changes go away

Hey guys. If you are using version of cordova-android less then 8.0.0 you can use my forked repository ionic cordova plugin add https://github.com/rhanesoghlyan/cordova-plugin-firebase.git#master --save

No need to change anything in platforms/ directory. It’s generated directory after adding the platform.

Working with cordova@9.0.0 the version of @dpa99c works wonderful.

So use: cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue

I removed and added the android platform: cordova platform rm android cordova platform add android

and everything works like charm

Many thanks from my side

same problem

The library com.google.android.gms:play-services-measurement-base is being requested by various other libraries at [[16.5.0,16.5.0], [16.4.0,16.4.0]], but resolves to 16.5.0. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.

i think this error is related to this.

Following worked for me.

target=android-28 android.library.reference.1=CordovaLib android.library.reference.2=app cordova.system.library.1=com.android.support:support-annotations:27.+ cordova.gradle.include.1=cordova-support-google-services/app-build.gradle cordova.gradle.include.2=phonegap-plugin-multidex/app-multidex.gradle cordova.system.library.2=com.android.support:support-v13:27.+ cordova.system.library.3=me.leolin:ShortcutBadger:1.1.17@aar cordova.system.library.4=com.google.firebase:firebase-messaging:17.3.0 cordova.system.library.5=com.google.android.gms:play-services-analytics:16.0.3 cordova.system.library.6=com.android.support:support-v4:24.1.1+ cordova.system.library.7=me.leolin:ShortcutBadger:1.1.17@aar cordova.system.library.8=com.android.support:support-v4:27+ cordova.system.library.9=com.google.firebase:firebase-analytics:16.0.3 cordova.system.library.11=com.android.support:appcompat-v7:23+

the solution is to don’t use this plugin anymore (as is not maintened), and replace it with cordova-plugin-firebase-lib (a fork with several fixes):

ionic cordova plugin remove cordova-plugin-firebase
ionic cordova plugin add cordova-plugin-firebase-lib@3.3.0 --save

This was the solution in my case

Thanks @remifleurance

Turns out it was another plugin causing the issue (old version of pushwoosh-cordova-plugin).

Thanks for all your help! Your initial solution is working.

@pbrisson Try with this build-extras.gradle :

def dependencyMap = [
        "com.google.firebase:firebase-core" : "16.0.8",
        "com.google.firebase:firebase-perf": "16.2.4",
        "com.google.firebase:firebase-messaging": "17.5.0",
        "com.google.firebase:firebase-config": "16.4.1",
        "com.google.firebase:firebase-iid": "17.1.1",
        "com.google.firebase:firebase-auth": "16.2.0",
        "com.google.android.gms:play-services-tagmanager": "16.0.8"
]

ext.postBuildExtras = {
    configurations.all {
        resolutionStrategy.eachDependency { DependencyResolveDetails details ->
            /* Note this new section */
            def requested = details.requested
            if (requested.group == 'com.android.support') {
                if (!requested.name.startsWith("multidex")) {
                    details.useVersion '26.1.0'
                }
            }

            def group = details.requested.group
            def name = details.requested.name
            def fullName =  group + ":" + name
            if (dependencyMap.containsKey(fullName)) {
                println 'Forcing version ' + dependencyMap[fullName] + ' for ' + fullName
                details.useVersion dependencyMap[fullName]
            }
        }
    }
}

Also clean and rebuild your project.

#1058

Failed to fetch plugin https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue via registry. Probably this is either a connection problem, or plugin spec is incorrect. Check your connection and plugin name/version/URL. Error: npm: Command failed with exit code 1 Error output: npm ERR! code 1 npm ERR! Command failed: /usr/bin/git checkout GH-1057-April-05-android-build-issue npm ERR! error: pathspec ‘GH-1057-April-05-android-build-issue’ did not match any file(s) known to git npm ERR!

npm ERR! A complete log of this run can be found in: npm ERR! /Users/marcosricardo/.npm/_logs/2019-07-24T13_08_19_728Z-debug.log

This is due to the firebase updates on April 05. Here https://firebase.google.com/support/release-notes/android#update_-_april_02_2019, I found the last working versions and adjusted my project.properties accordingly like so

cordova.system.library.4=com.google.firebase:firebase-core:16.0.8 cordova.system.library.5=com.google.firebase:firebase-messaging:17.5.0 cordova.system.library.6=com.google.firebase:firebase-config:16.4.1 cordova.system.library.7=com.google.firebase:firebase-perf:16.2.4

Here all dependencies are locked to the specific version (Update - April 02, 2019) instead of +, which would get you the latest version thus breaking the build process.

Now I can build successfully! Hope it helps!

If firebase-messaging:17.5.0 don’t work use firebase-messaging:17.6.0

I fixed this for me with a minimal fix, setting the versions of the firebase-libs to specific versions. So the cordova-plugin-firebase should work like it did before the update in die firebase android libs. Here is the diff: master…ylno:master

You can use this fixed version with: cordova plugin add https://github.com/ylno/cordova-plugin-firebase.git

This finally worked for me! I tried a lot of different things posted above, but this finally helped me. Thanks a lot @ylno

I fixed this for me with a minimal fix, setting the versions of the firebase-libs to specific versions. So the cordova-plugin-firebase should work like it did before the update in die firebase android libs. Here is the diff: https://github.com/arnesson/cordova-plugin-firebase/compare/master...ylno:master

You can use this fixed version with: cordova plugin add https://github.com/ylno/cordova-plugin-firebase.git

Here’s how I’ve fixed it, I’ve tried many of the solutions above, and on other discussions but none of em worked for me.

Follow those steps & 👍

1. I’ve deleted everything ( platform, plugins & package-lock.json, node_modules ).

rm -rf package-lock.json platforms/ plugins/ node_modules/

2. make sure you’ve deleted cordova-plugin-firebase from both, your package.json & config.xml

3. add a fresh platform & install the needed modules

cordova platforms add android && npm install

4. add cordova-android-firebase-gradle-release plugin

cordova plugin add cordova-android-firebase-gradle-release

Now just clean & build, I hope this will help someone out there, as it drove me crazy for hours.

This has worked perfectly for me 😃

@ebizbuddy please provide your error message

Same error logged by clanglois421 for opening this thread.

The workaround mentioned by fjckls doesn’t work for my project.

Also tried the solution mentioned by ReaperTech but still no good.

FINALLY, thanks to rajapradeep

Following worked:

Replace your cordova-plugin-firebase files - FirebasePlugin.java FirebasePluginMessageReceiver.java FirebasePluginMessageReceiverManager.java OnNotificationOpenReceiver.java

from https://github.com/dpa99c/cordova-plugin-firebase/tree/143f450894e89ff7d77d31197738386d5bea2a16/src/android

and delete FirebaseInstanceIdService.Java file from folder \platforms\android\app\src\main\java\org\apache\cordova\firebase\

@rajapradeep your solution worked for my by copied the files.

I also had to delete a service entry in the AndroidManifest.xml file

<service android:name="org.apache.cordova.firebase.FirebasePluginInstanceIDService">
            <intent-filter>
                <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
            </intent-filter>
        </service>

Didnt end up needing to edit the project.properties file

cordova.system.library.4=com.google.firebase:firebase-core:16.0.8 cordova.system.library.5=com.google.firebase:firebase-messaging:17.5.0 cordova.system.library.6=com.google.firebase:firebase-config:16.4.1 cordova.system.library.7=com.google.firebase:firebase-perf:16.2.4

This working for me. But make sure there is no space after each line. I added these lines in build. girdle file and project properties file

The Solution in This Link Worked for me.

  1. Remove cordova-firebase-plugin with ionic cordova plugin remove cordova-firebase-plugin
  2. Install: ionic cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue
  3. rm -rf node_modules/ plugins/ platforms/android package-lock.json
  4. npm install
  5. ionic cordova platform add android
  6. ionic cordova build android

thx, it’s working

I’ve created PR #1058 to fix this by updating the plugin code to remove/replace references to deprecated API features that were removed in the April 05 Firebase SDK release.

Until such time as it has been merged, you can install the fixed plugin directly off my fork:

cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue

@MianAzhar this solution will work for ionic v3 as I am using that aswell and this one works for me

This is due to the firebase updates on April 05. Here https://firebase.google.com/support/release-notes/android#update_-_april_02_2019, I found the last working versions and adjusted my project.properties accordingly like so

cordova.system.library.4=com.google.firebase:firebase-core:16.0.8 cordova.system.library.5=com.google.firebase:firebase-messaging:17.5.0 cordova.system.library.6=com.google.firebase:firebase-config:16.4.1 cordova.system.library.7=com.google.firebase:firebase-perf:16.2.4

Here all dependencies are locked to the specific version (Update - April 02, 2019) instead of +, which would get you the latest version thus breaking the build process.

Now I can build successfully! Hope it helps!

This is a workaround - you can use the original plugin (not the forked one from @dpa99c) and it will build

@dpa99c Do you know what is causing my issue?

See microsoft/react-native-code-push#1448

Thanks! Solved it.

I’ve created PR #1058 to fix this by updating the plugin code to remove/replace references to deprecated API features that were removed in the April 05 Firebase SDK release.

Until such time as it has been merged, you can install the fixed plugin directly off my fork:

cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue

Can confirm it works!

This is due to the firebase updates on April 05. Here https://firebase.google.com/support/release-notes/android#update_-_april_02_2019, I found the last working versions and adjusted my project.properties accordingly like so

cordova.system.library.4=com.google.firebase:firebase-core:16.0.8 cordova.system.library.5=com.google.firebase:firebase-messaging:17.5.0 cordova.system.library.6=com.google.firebase:firebase-config:16.4.1 cordova.system.library.7=com.google.firebase:firebase-perf:16.2.4

Here all dependencies are locked to the specific version (Update - April 02, 2019) instead of +, which would get you the latest version thus breaking the build process.

Now I can build successfully! Hope it helps!

Thank you very much!