arnesson / cordova-plugin-firebase

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

New error on android build since 06-05-2019 #1057

Open clanglois421 opened 5 years ago

clanglois421 commented 5 years ago

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

rodriguezmanu commented 5 years ago

+1

gartorware commented 5 years ago

Same here. Tried to use cordova-play-services-gradle-release plugin (with + and 15.+) without success.

jordanorc commented 5 years ago

+1 Same problem here.. any suggestion?

ejlodero commented 5 years ago

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.

sahyun1 commented 5 years ago

@ejlodero I get the same error. I wonder why this is happening as this plugin is not updated since last year

pbejarano commented 5 years ago

@ejlodero I get the same error, I am looking in my graddle but I dont see that dependencies, some body found something?

urjunior87 commented 5 years ago

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.

jcruzrg commented 5 years ago

Hi, i have the same problem

nystsam commented 5 years ago

+1

munkyukim commented 5 years ago

+1

emilwang commented 5 years ago

+1

hcassar93 commented 5 years ago

+1

syagawa commented 5 years ago

i have the same problem....

BrunoTMartins commented 5 years ago

Same issue here, any hint?

corrrso commented 5 years ago

Same problem.

raiyanihiren commented 5 years ago

Same problem

JLopezZn commented 5 years ago

same problem

syedmaqbool commented 5 years ago

same problem

sujungeo commented 5 years ago

same problem

pluckannfeel commented 5 years ago

have the same problem

cd11103 commented 5 years ago

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

pvillaverde commented 5 years ago

Same problem here

fjckls commented 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!

pluckannfeel commented 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!

where will you find project.properties

pvillaverde commented 5 years ago

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

hellkith commented 5 years ago

@fjckls I've tried your fix, and the Gradle sync will work but building the app still throws the errors for as given by topic starter where it cannot find the methods from Firebase.

syagawa commented 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!

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

pluckannfeel commented 5 years ago

i got two errors,

Failed to resolve: com.google.firebase:firebase-messaging:17.5 Failed to resolve: com.google.firebase:firebase-config:16.4

i got two errors, Failed to resolve: com.google.firebase:firebase-messaging:17.5 Failed to resolve: com.google.firebase:firebase-config:16.4

you forgot to add the final bit of it. messaging = 17.5.0 config = 16.4.1

exactly, my reply was wrong but yeah thats what i put, still error

hellkith commented 5 years ago

i got two errors,

Failed to resolve: com.google.firebase:firebase-messaging:17.5 Failed to resolve: com.google.firebase:firebase-config:16.4

you forgot to add the final bit of it. messaging = 17.5.0 config = 16.4.1

jetwitaussi commented 5 years ago

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!

adamterlson commented 5 years ago

I found this thread searching for this exact issue, but I'm not using Cordova, and instead React Native.

Anyway, updating my build.gradle to the following did not fix the issue for me:

    implementation "com.google.firebase:firebase-core:16.0.8"
    implementation "com.google.firebase:firebase-messaging:17.5.0"

Am I missing something?

marcus13371337 commented 5 years ago

Same problem

hellkith commented 5 years ago

What I did to fix the build issues is the following: Project.properties Set the firebase items to the following: com.google.firebase:firebase-core:16.0.8 com.google.firebase:firebase-messaging:17.6.0 com.google.firebase:firebase-config:16.5.0 com.google.firebase:firebase-perf:16.2.5

app/build.grade Set the firebase items to the following: compile "com.google.firebase:firebase-core:16.0.8" compile "com.google.firebase:firebase-messaging:17.6.0" compile "com.google.firebase:firebase-config:16.5.0" compile "com.google.firebase:firebase-perf:16.2.5"

It makes it possible to build the app without errors. However in the app it will throw errors, stating that functions do not exist.

for example: ERROR Error: Uncaught (in promise): TypeError: Object(...) is not a function TypeError: Object(...) is not a function at Firebase.grantPermission (vendor.js:60669)

dpa99c commented 5 years ago

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
aswinaryal commented 5 years ago

same problem

inti25 commented 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!

Thank you ! you save my time ^^

justlester commented 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!

Thank you very much!

opiispanen commented 5 years ago

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

This worked for me!

jordanorc commented 5 years ago

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

It works perfectly now, thank you very much @dpa99c!

Bigalan09 commented 5 years ago

I'm getting an error:

In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[15.0.
2]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.

Dependency failing: com.google.android.gms:play-services-tagmanager-api:15.0.2 -> com.google.android.gms:play-services-m
easurement-base@[15.0.2], but play-services-measurement-base version was 15.0.4.
kalandher commented 5 years ago

I got this error

Error: 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. Failed to get absolute path to installed module

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
jetwitaussi commented 5 years ago

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

@dpa99c Can't make it work for ionic v1:

[...]
:CordovaLib:checkDebugManifest
:CordovaLib:processDebugManifest
:preDebugBuild FAILED

FAILURE: Build failed with an exception.

* What went wrong:
1

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

* Get more help at https://help.gradle.org

BUILD FAILED in 4s

i have removed the cordova plugin, add your branch, remove and add platform my config:

Cordova CLI: 6.5.0
Gulp version:  CLI version 3.9.1
Gulp local:   Local version 3.9.1
Ionic CLI Version: 1.7.16
Ionic App Lib Version: 0.7.3
ios-deploy version: 1.9.2
ios-sim version: 6.1.2
OS: Mac OS X El Capitan
Node Version: v6.11.3
Xcode version: Xcode 9.4.1 Build version 9F2000
dpa99c commented 5 years ago

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
hellkith commented 5 years ago

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!

jetwitaussi commented 5 years ago

i did it, twice, and no luck, still the same error

Vaweila commented 5 years ago

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

I can confirm @dpa99c's fork to be working for Ionic3 projects.

I executed commands in following order:

ionic cordova platform rm android npm uninstall @ionic-native/firebase ionic cordova plugin rm cordova-plugin-firebase cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue npm install --save @ionic-native/firebase@4

and finally, ionic cordova run android to build the app

jetwitaussi commented 5 years ago

i have cordova android@6.4.0 can it a reason the fix does not work?

dpa99c commented 5 years ago

i have cordova android@6.4.0 can it a reason the fix does not work?

Yes:

Probably because the compile SDK version is different.

opiispanen commented 5 years ago

i have cordova android@6.4.0 can it a reason the fix does not work?

@jetwitaussi I also had ionic v1 project and upgraded from that to 7.1.4 and it worked.

jetwitaussi commented 5 years ago

last time i tested it didn't work and had no time to find why. will try to find some time now :)