Ionic 4 Cordova - Run Android Firebase error all of a sudden

Hello,
I am building a mobile app using Ionic 4 + Cordova. It was compiling perfectly ok for a few dozens builds, no problem whatsoever.

I made a very small change in the code, nothing changes in plugins, NPM or whatever else. And all of a sudden, it fails during compilation with:

platforms\android\app\src\main\java\com\gae\scaffolder\plugin\MyFirebaseInstanceIDService.java:6: error: cannot find symbol
import com.google.firebase.iid.FirebaseInstanceIdService;
^
symbol: class FirebaseInstanceIdService
location: package com.google.firebase.iid

I am using the below cordova plugins (and was using the same when it was compiling ok):

  • device
  • vibration
  • firebase
  • fcm-with-dependecy-updated
  • NFC

I tried whatever I could find on the net, but nothing changed.
One of the suggestions was to also add firebase-auth, even if not used, which I did but didnt have any effect, so I removed it.
(edit: I also tried removing and re-adding the android platform, again no effect)

Any ideas? (as it is for a project with a deadline in 2 days, I would really appreciate any help I can get quickly)…
MANY thanks !

5 Likes

I have the same error with ionic 3.9

Ionic info:


cli packages: (/usr/lib/node_modules)

    @ionic/cli-utils  : 1.9.2
    ionic (Ionic CLI) : 3.9.2

global packages:

    Cordova CLI : 8.1.2 (cordova-lib@8.1.1) 

local packages:

    @ionic/app-scripts : 3.2.3
    Cordova Platforms  : android 6.4.0 browser 5.0.4
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    Node              : v11.14.0
    npm               : 6.9.0 
    OS                : Linux 4.19

I think that is a gradle error, my friend with other project have the same error.

:mergeDebugJniLibFolders
        :CordovaLib:processDebugResources
        :processDebugResources
        :generateDebugSources
        :CordovaLib:generateDebugSources
        :CordovaLib:compileDebugJavaWithJavacNote: Some input files use or override a deprecated API.
        Note: Recompile with -Xlint:deprecation for details.
        
        :CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug
        :javaPreCompileDebug
        :compileDebugJavaWithJavac/home/juan/Documents/Work/Players/app_players/platforms/android/src/com/gae/scaffolder/plugin/MyFirebaseInstanceIDService.java:6: 
        error: cannot find symbol
        import com.google.firebase.iid.FirebaseInstanceIdService;
                                       ^
           symbol:   class FirebaseInstanceIdService
           location: package com.google.firebase.iid
        /home/juan/Documents/Work/Players/app_players/platforms/android/src/com/gae/scaffolder/plugin/MyFirebaseInstanceIDService.java:11: 
        error: cannot find symbol
        public class MyFirebaseInstanceIDService extends FirebaseInstanceIdService {
                                                          ^
           symbol: class FirebaseInstanceIdService
        /home/juan/Documents/Work/Players/app_players/platforms/android/src/com/gae/scaffolder/plugin/MyFirebaseInstanceIDService.java:15: 
        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.
        3 errors
          FAILED
        
        FAILURE: Build failed with an exception.

I’m facing exactly the same error! It started today suddenly!

Build output:

BUILD FAILED in 56s
35 actionable tasks: 35 executed
/Users/ibnclaudius/Development/leetags-app-new/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/ibnclaudius/Development/leetags-app-new/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
/Users/ibnclaudius/Development/leetags-app-new/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
/Users/ibnclaudius/Development/leetags-app-new/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
^
/Users/ibnclaudius/Development/leetags-app-new/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
/Users/ibnclaudius/Development/leetags-app-new/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
/Users/ibnclaudius/Development/leetags-app-new/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)
/Users/ibnclaudius/Development/leetags-app-new/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
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
7 errors

FAILURE: Build failed with an exception.

My ionic info output:

Ionic:

ionic (Ionic CLI) : 4.12.0 (/Users/ibnclaudius/.nvm/versions/node/v11.2.0/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.3.0
@angular-devkit/build-angular : 0.13.8
@angular-devkit/schematics : 7.2.4
@angular/cli : 7.3.8
@ionic/angular-toolkit : 1.4.1

Cordova:

cordova (Cordova CLI) : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 7.1.4, ios 5.0.1
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 17 other plugins)

System:

ios-deploy : 1.9.4
ios-sim : 8.0.1
NodeJS : v11.2.0 (/Users/ibnclaudius/.nvm/versions/node/v11.2.0/bin/node)
npm : 6.9.0
OS : macOS Mojave
Xcode : Xcode 10.1 Build version 10B61

What are the versions of the firebase related plugins you guys use?

My package.json:

“@ionic-native/firebase”: “^5.5.0”,
“@ionic-native/firebase-analytics”: “^5.5.0”,
“cordova-plugin-firebase”: “2.0.5”,

config

 <engine name="android" spec="6.4.0" />
 <plugin name="cordova-plugin-fcm" spec="2.1.2" />

Package json

 "@ionic-native/fcm": "^4.17.0",
1 Like

I created a topic on slack as well regarding this, and at first we thought that it was due to me using both firebase & FCM plugins, but after you posted you had the same issue as well all of a sudden, we arrived to the conclusion that something must be broken on the repositories where gradle is pulling its stuff from…
Maybe it’s better to wait it out for a bit and see if it fixes itself…

3 Likes

Probably. I didn’t change anything related to Firebase and the build started to fail out of nowhere.

I’ll leave it be for now, it’s late anyway… If it starts working again for you, please post here and let us all know :slight_smile: Thanks :slight_smile:

I’ll also wait while developing other features. Any progress related to this Firebase error I’ll post here. Keep me posted as well. Thanks!

Same problem here :open_mouth: so weird. Please let me know if you find any solution! I’ll post here the same.

Hi, I am having the issue right now. Tuesday, 7 May 2019. Was working on my project and didn’t change anything, except for my view codes. The only difference here is I am not using ionic 4.

Have been compiling and running the project for more than 10 times today, and when I change the arrangement of my card list a bit, suddenly this happens. My last build was just a few minutes ago. Now all my project cannot run. Already restart my PC as well. Hope it gets fixed soon…

Hi, i have the same problem. But im used ionic 3, cordova-plugin-firebase and android platform 7.1.4

Same problem here for ionic 3.20.0 with android 6.4.0 and cordova-plugin-fcm 2.1.2 “FCMPlugin”

Well, it seems like i’m not the only one… and yes, i’m using ionic 3 too, so I think it not depends on ionic itself, it’s more like a problem with a google/firebase plugin

Their travis tests are failing, take a look

I’m having the same problem all of a sudden it began failing to buid, specifically with this library “com.google.android.gms:play-services-measurement-base” does anyone have an idea how to solve this? I haven’t added anything new to the project, I really need some help.

1 Like

I have the same problem with ionic v1

“cordova-android”: “6.4.0”
“cordova-plugin-firebase”: “^2.0.5”

I faced both issues mentioned in this thread. At first, my app was not able to build. Had the same issue @mmzepedab mentioned. Some plugin using [16.5.0, 16.4.0] version range which is not allowed thus app cannot be built. Then I tried cordova-android-play-services-gradle-release & cordova-android-firebase-gradle-release and encountered a new error which is the same what everyone else is facing here.
These errors are beyond my knowledge to fix.

Hi, i have the same problem with ionic v3
My ionic info output:

Ionic:

   ionic (Ionic CLI)  : 4.12.0
   Ionic Framework    : ionic-angular 3.9.4
   @ionic/app-scripts : 3.2.3

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : android 7.1.4, browser 5.0.4, ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.3.2, (and 9 other plugins)

System:

   ios-deploy        : 1.9.4
   npm               : 6.9.0
   OS                : macOS High Sierra
   Xcode             : Xcode 10.1 Build version 10B61

I am also getting same error if find any solution please post here.

Thanks