Cordova-plugin-firebase: Error during Cordova build Android

Created on 18 Jun 2018  路  8Comments  路  Source: arnesson/cordova-plugin-firebase

Hi,

keep on getting this error. Does it sound familiar?

Error: /Users/user/Sites/app/platforms/android/gradlew: Command failed with exit code 1 Error output:

Note: Some input files use or override a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

/Users/user/Sites/app/platforms/android/src/org/apache/cordova/firebase/FirebasePluginMessagingService.java:129: error: constructor Builder in class Builder cannot be applied to given types;
            NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, channelId);
                                                             ^
  required: Context
  found: FirebasePluginMessagingService,String
  reason: actual and formal argument lists differ in length
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.
1 error

FAILURE: Build failed with an exception.

cordova CLI: v7.1.0
cordova-android: v6.4.0
OS: macOS v10.13.4

I'm trying to make use of this plugin along with the following:

      "cordova-android-firebase-gradle-release": {
        "FIREBASE_VERSION": "12.+"
      },
      "cordova-android-play-services-gradle-release": {
        "PLAY_SERVICES_VERSION": "12.+"
      },

This is what I'm targeting in the config.xml:

<preference name="android-minSdkVersion" value="17" />
<preference name="android-targetSdkVersion" value="23" />

Most helpful comment

@soumak77 it would be great if you posted what the fix is .... I looked at the change log and didnt find anything that mentioned this error.

All 8 comments

I am having the same issue

I have the same issue too, please help

@asifmehmood91 @zahersi I sorted this out doing the following:

  <plugin name="cordova-android-firebase-gradle-release" spec="^1.0.2">
    <variable name="FIREBASE_VERSION" value="11.0.+" />
  </plugin>
  <plugin name="cordova-android-play-services-gradle-release" spec="^1.4.3">
    <variable name="PLAY_SERVICES_VERSION" value="11.0.+" />
  </plugin>
  • As you can see I'm being more specific by using 11.0.+, it might be ok with 12.0.+ but I haven't tried yet.
  • I've also bumped the android-minSdkVersion up, from 17 to 18
  • I'm now using cordova-android 7.0.0 whereas before, I was using 6.4.0.

p.s. Make sure to delete the generated iOS and android folders within the platforms directory and build everything from scratch with cordova prepare or cordova platform add ...

Hope this helps.

thanks @fabrz but unfortunately I'm still getting the same error message when trying to build or run on android.

my installed plugins are:
`

  • cordova-android-firebase-gradle-release 1.0.2 "cordova-android-firebase-gradle-release"
  • cordova-android-play-services-gradle-release 1.4.3 "cordova-android-play-services-gradle-release"
  • cordova-plugin-dialogs 2.0.1 "Notification"
  • cordova-plugin-firebase 1.0.5 "Google Firebase Plugin"
  • 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-vibration 3.1.0 "Vibration"
  • cordova-plugin-whitelist 1.3.3 "Whitelist"

`

my config.xml contains:
<plugin name="cordova-android-firebase-gradle-release" spec="^1.0.2"> <variable name="FIREBASE_VERSION" value="11.0.+" /> </plugin> <plugin name="cordova-android-play-services-gradle-release" spec="^1.4.3"> <variable name="PLAY_SERVICES_VERSION" value="11.0.+" /> </plugin> <plugin name="cordova-plugin-firebase" spec="cordova-plugin-firebase"> <variable name="ANDROID_SUPPORT_VERSION" value="26.+" /> </plugin> <engine name="android" spec="^7.0.0" />

can you help please

thanks @fabrz it worked using cordova-android-support-gradle-release
I upgraded my cordova-android-support-gradle-release's ANDROID_SUPPORT_VERSION variable from 25.+ to 26.+ and it worked

original issue link:
https://github.com/arnesson/cordova-plugin-firebase/issues/676

I have this error when using with facebook ads plugins from https://github.com/floatinghotpot/cordova-plugin-facebookads
(Actually it's this one:
cordova plugin add https://github.com/ElieSauveterre/cordova-plugin-facebookads#d540140816f93ee37ebef8cf5b05e438db17588a
)
When I remove the FB ads plugin it works good.

Does anyone using both of these plugins together, successfully?
Thanks.

closing as resolved since the original creator has found a fix

@soumak77 it would be great if you posted what the fix is .... I looked at the change log and didnt find anything that mentioned this error.

Was this page helpful?
0 / 5 - 0 ratings