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
- Fixes issues cause by Firebase SDK updates on 5 April 2019 (https://firebase.google.com/support/release-notes/android#update_-_april_05_2019) which removed deprecated API features causing Android buil... — committed to dpa99c/cordova-plugin-firebasex by dpa99c 5 years ago
- Fixes issues cause by Firebase SDK updates on 5 April 2019 (https://firebase.google.com/support/release-notes/android#update_-_april_05_2019) which removed deprecated API features causing Android buil... — committed to dpa99c/cordova-plugin-firebasex by dpa99c 5 years ago
- Fix: Trying to fix mobile build after firebase update https://github.com/arnesson/cordova-plugin-firebase/issues/1057#issuecomment-490006344 — committed to spartansolutions/cordova-plugin-firebase by callum-spartan 5 years ago
- Merge pull request #2 from dpa99c/GH-1057-April-05-android-build-issue dpa99c / Gh 1057 april 05 android build issue — committed to sachingarg05/cordova-plugin-firebase by sachingarg05 5 years ago
- Merge pull request #1 from dpa99c/GH-1057-April-05-android-build-issue Gh 1057 april 05 android build issue — committed to marcelinojung/cordova-plugin-firebase-cocoa by marcelinojung 5 years ago
- Fixes issues cause by Firebase SDK updates on 5 April 2019 (https://firebase.google.com/support/release-notes/android#update_-_april_05_2019) which removed deprecated API features causing Android buil... — committed to propelinc/cordova-plugin-firebase by dpa99c 5 years ago
- Fixes issues cause by Firebase SDK updates on 5 April 2019 (https://firebase.google.com/support/release-notes/android#update_-_april_05_2019) which removed deprecated API features causing Android buil... — committed to m0dch3n/cordova-plugin-firebase by dpa99c 5 years ago
- Correcciones de problema en firebase: https://github.com/arnesson/cordova-plugin-firebase/issues/1057 — committed to tanoinc/mi-universidad-app by deleted user 5 years ago
- Fijo las versiones según https://github.com/arnesson/cordova-plugin-firebase/issues/1057#issuecomment-490000068 — committed to radiocutfm/cordova-plugin-firebase by gnarvaja 5 years ago
- Merge pull request #1 from dpa99c/GH-1057-April-05-android-build-issue Gh 1057 april 05 android build issue — committed to phattranky/cordova-plugin-firebase by phattranky 5 years ago
- Fixes issues cause by Firebase SDK updates on 5 April 2019 (https://firebase.google.com/support/release-notes/android#update_-_april_05_2019) which removed deprecated API features causing Android buil... — committed to wizpanda/cordova-plugin-firebase-lib by dpa99c 5 years ago
- Merge remote-tracking branch 'remotes/dpa99c/GH-1057-April-05-android-build-issue' — committed to jfougere/cordova-plugin-firebase by deleted user 5 years ago
- Merge remote-tracking branch 'remotes/dpa99c/GH-1057-April-05-android-build-issue' — committed to jfougere/cordova-plugin-firebase by deleted user 5 years ago
- Revert: Merge remote-tracking branch 'remotes/dpa99c/GH-1057-April-05-android-build-issue' — committed to jfougere/cordova-plugin-firebase by deleted user 5 years ago
- Revert: Merge remote-tracking branch 'remotes/dpa99c/GH-1057-April-05-android-build-issue' — committed to jfougere/cordova-plugin-firebase by deleted user 5 years ago
- Merge remote branch dpa99c/cordova-plugin-firebase/GH-1057-April-05-android-build-issue — committed to Monsenso/cordova-plugin-firebase by deleted user 5 years ago
- Merge branch 'GH-1057-April-05-android-build-issue' — committed to surgeventures/cordova-plugin-firebase by deleted user 5 years ago
- Merge branch 'GH-1057-April-05-android-build-issue' of https://github.com/dpa99c/cordova-plugin-firebase # Conflicts: # docs/NOTIFICATIONS.md — committed to KDPInnovations/cordova-plugin-firebase by deleted user 5 years ago
- Fixes issues cause by Firebase SDK updates on 5 April 2019 (https://firebase.google.com/support/release-notes/android#update_-_april_05_2019) which removed deprecated API features causing Android buil... — committed to artistgrowth/cordova-plugin-firebase by dpa99c 5 years ago
- Merge branch 'GH-1057-April-05-android-build-issue' of https://github.com/dpa99c/cordova-plugin-firebase into dpa99cfix — committed to mghiozzi/cordova-plugin-firebase by deleted user 5 years ago
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
copy_build_extra.js
add new hook to config.xml’s
<android>
tag. https://cordova.apache.org/docs/en/9.x/guide/appdev/hooks/index.html#page-toc-sourceupdated 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
(add “15.” before “+”)
and file plugins/cordova-plugin-firebase/src/android/build.gradle
(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:
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):
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.
Remove cordova-firebase-plugin with ionic cordova plugin remove cordova-firebase-plugin
Install: ionic cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue
rm -rf node_modules/ plugins/ platforms/android package-lock.json
npm install
ionic cordova platform add android
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:
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:
To have more details about how to use this file, please refer to the original solution here
where will you find project.properties
here is the complete step what i did for fixing this issue:
Note: If you are using resource file tag inside config.xml for custom notification icons like:
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)
@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 ).
2. make sure you’ve deleted
cordova-plugin-firebase
from both, yourpackage.json
&config.xml
3. add a fresh platform & install the needed modules
4. add
cordova-android-firebase-gradle-release
pluginNow 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:
I succeeded in rewrite
platforms/android/app/build.gradle
andplatforms/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
You can use resolutionStrategy.force to force dependencies versions :
Thanks for the tip, it works for me
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
rm -rf package-lock.json platforms/ plugins/ node_modules/
make sure you’ve deleted cordova-plugin-firebase from both, your package.json & config.xml
add the forked plugin cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue
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
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+
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
:Also
clean
andrebuild
your project.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
If firebase-messaging:17.5.0 don’t work use firebase-messaging:17.6.0
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
This has worked perfectly for me 😃
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
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
thx, it’s working
@MianAzhar this solution will work for ionic v3 as I am using that aswell and this one works for me
This is a workaround - you can use the original plugin (not the forked one from @dpa99c) and it will build
Thanks! Solved it.
Can confirm it works!
Thank you very much!