cannot find symbol import com.google.firebase.iid.FirebaseInstanceIdService error in ionic3

error: cannot find symbol class firebasemessagingservice
import com.google.firebase.iid.firebaseinstanceidservice error android
class file for com google firebase-iid zzb not found
com.google.firebase.iid.firebaseinstanceidservice not found android
r8 missing class com google firebase iid firebaseinstanceidservice
com google firebase iid firebaseinstanceidservice is deprecated more ⌘ f1
com.google.firebase.iid.firebaseinstanceidservice maven
firebaseinstanceidservice doesn t exist

I Have no idea why I am getting this error whenever I try to create my app's build.I have tried many solutions but I was unable to solve this.i don't know if any plugins is causing issues or if there's any issue with my Code or firebase or firebase connectivity.I have deleted node modules and run npm install and removed and re-added android platform but still i am getting this error.

import com.google.firebase.iid.FirebaseInstanceIdService;
                              ^
  symbol:   class FirebaseInstanceIdService
  location: package com.google.firebase.iid
C:\Users\user\Downloads\mosque\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePluginInstanceIDService.java:9: error: cannot find symbol
public class FirebasePluginInstanceIDService extends FirebaseInstanceIdService {
                                                     ^
  symbol: class FirebaseInstanceIdService
C:\Users\user\Downloads\mosque\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePlugin.java:508: 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
C:\Users\user\Downloads\mosque\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePlugin.java:525: 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
C:\Users\user\Downloads\mosque\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePlugin.java:579: 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)
C:\Users\user\Downloads\mosque\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePluginInstanceIDService.java:18: 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: C:\Users\user\Downloads\mosque\platforms\android\app\src\main\java\io\card\cordova\sdk\CardIOCordovaPlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
6 errors
:app:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
27 actionable tasks: 1 executed, 26 up-to-date
> Compilation failed; see the compiler error output for details.

* 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 54s
cmd: Command failed with exit code 1 Error output:
C:\Users\user\Downloads\mosque\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
C:\Users\user\Downloads\mosque\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePluginInstanceIDService.java:9: error: cannot find symbol
public class FirebasePluginInstanceIDService extends FirebaseInstanceIdService {
                                                     ^
  symbol: class FirebaseInstanceIdService
C:\Users\user\Downloads\mosque\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePlugin.java:508: 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
C:\Users\user\Downloads\mosque\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePlugin.java:525: 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
C:\Users\user\Downloads\mosque\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePlugin.java:579: 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)
C:\Users\user\Downloads\mosque\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePluginInstanceIDService.java:18: 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: C:\Users\user\Downloads\mosque\platforms\android\app\src\main\java\io\card\cordova\sdk\CardIOCordovaPlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
6 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* 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 54s
[ERROR] An error occurred while running subprocess cordova.

        cordova build android exited with exit code 1.

Yes, it's depreciated. The fix it quite simple, just move the code...

From onTokenRefresh() in your FirebaseInstanceIdService subclass

To onNewToken() in your FirebaseMessagingService subclass

Info on depreciation: https://firebase.google.com/support/release-notes/android#update_-_april_02_2019

I would recommend making this small code change over using old versions of firebase. Probably a good idea to also migrate to AndroidX [https://developer.android.com/jetpack/androidx/migrate] while you're at it.

error: cannot find symbol import com.google.firebase.iid , error: cannot find symbol import com.google.firebase.iid.​FirebaseInstanceIdService #1092. Open. Imam-N opened this issue on Jul 12, 2019 · 6 comments. import com.google.firebase.iid.FirebaseInstanceIdService; ^ symbol: class FirebaseInstanceIdService location: package com.google.firebase.iid D:\Balaji Workspace React native\SPIUnlimited\phase 2 Unlimited\unlimited-phase-ii ode_modules\react-native-fcm\android\src\main\java\com\evollu\react\fcm\InstanceIdService.java:16: error: cannot find symbol


This is due to the Firebase updates on April 05. Here https://firebase.google.com/support/release-notes/android#update_-_april_02_2019 96, 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!

project.properties can be found on platforms/android/project.properties

Ionic 4 Cordova, java:6: error: cannot find symbol import com.google.firebase.iid.​FirebaseInstanceIdService; ^ symbol: class FirebaseInstanceIdService location:  Also I get a new error: com.google.firebase-iid is being requested by various other libraries at [[17.1.1, 17.1.1]], but resolves to 19.0.0 I'm currently trying to fix that as well but since we are talking about integrating a maintained google plugin there should be some stable solution.


After serveral tests, my solution was change cordova-plugin-firebase by cordova-plugin-firebasex. https://github.com/dpa99c/cordova-plugin-firebase#migrating-from-cordova-plugin-firebase

rm -Rf platforms/android
cordova plugin rm cordova-plugin-firebase
rm -Rf plugins/ node_modules/
npm install
cordova plugin add cordova-plugin-firebasex
cordova platform add android

I hope this helps.

https://github.com/dpa99c/cordova-plugin-firebase#androidx

This plugin has been migrated to use AndroidX (Jetpack) which is the successor to the Android Support Library. This is implemented by adding a dependency on cordova-plugin-androidx which enables AndroidX in the Android platform of a Cordova project.

This is because the major release of the Firebase and Play Services libraries on 17 June 2019 were migrated to AndroidX.

Therefore if your project includes any plugins which are dependent on the legacy Android Support Library, you should add cordova-plugin-androidx-adapter to your project. This plugin will dynamically migrate any plugin code from the Android Support Library to AndroidX equivalents.

The library com.google.firebase:firebase-iid is being requested by , Describe the bug I think it is problem with the firebase version. rm -Rf platforms/​android ionic cordova plugin rm cordova-plugin-firebase rm -Rf plugins/ node_modules/ npm error: cannot find symbol import com.google.firebase.iid.​FirebaseInstanceIdService; ^ symbol: class FirebaseInstanceIdService location: package  cannot find symbol import com.google.firebase.iid.FirebaseInstanceIdService in cordova Latest Firebase Updation I got the New Error: cannot find symbol import com.google.firebase.iid.


This issue occurs due to major firebase release to support AndroidX

Solution:

  1. Remove android platform(I followed this step. but there should be workaround which I might not know) - cordova platform rm android

  2. Remove old firebase plugin - cordova plugin rm cordova-plugin-firebase

  3. Add new firebase plugin - cordova plugin add cordova-plugin-firebasex

  4. Again add platform - cordova platform add android

Now your build will succeed.

Android Studio: how to solve cannot find symbol class, We discuss how to solve cannot find symbol class "FirebaseInstanceIdService" in android Duration: 3:21 Posted: Aug 24, 2019 If this problem happens in React Native frameworks.There are two solutions:. solution 1 (recommended):. change firebase version in below files: android\app\build.gradle


If this problem happens in React Native frameworks.There are two solutions:

solution 1 (recommended):

change firebase version in below files: android\app\build.gradle

...
//implementation 'com.google.firebase:firebase-core'
//implementation 'com.google.firebase:firebase-messaging'
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-messaging:17.6.0'
...

And in android\gradle.properties at the bottom of file add

firebaseCoreVersion=16.0.8
firebaseMessagingVersion=17.6.0
solution 2:

Change \node_modules\react-native-fcm\android\src\main\java\com\evollu\react\fcm\InstanceIdService.java file as complete below.

package com.evollu.react.fcm;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;

import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.bridge.ReactContext;
import com.google.firebase.iid.FirebaseInstanceId;
//import com.google.firebase.iid.FirebaseInstanceIdService; //Commented FirebaseInstanceIdService
import com.google.firebase.messaging.FirebaseMessagingService;  //ADD FirebaseMessagingService

public class InstanceIdService extends FirebaseMessagingService {

    private static final String TAG = "InstanceIdService";

    /**
     * Called if InstanceID token is updated. This may occur if the security of
     * the previous token had been compromised. This call is initiated by the
     * InstanceID provider.
     */
    // [START refresh_token]
    @Override
    public void onNewToken(String token) { //Added onNewToken method
        // Get updated InstanceID token.
        String refreshedToken = FirebaseInstanceId.getInstance().getToken();
        Log.d(TAG, "Refreshed token: " + refreshedToken);

        // Broadcast refreshed token
        Intent i = new Intent("com.evollu.react.fcm.FCMRefreshToken");
        Bundle bundle = new Bundle();
        bundle.putString("token", refreshedToken);
        i.putExtras(bundle);

        final Intent message = i;

        Handler handler = new Handler(Looper.getMainLooper());
        handler.post(new Runnable() {
            public void run() {
                // Construct and load our normal React JS code bundle
                ReactInstanceManager mReactInstanceManager = ((ReactApplication) getApplication()).getReactNativeHost().getReactInstanceManager();
                ReactContext context = mReactInstanceManager.getCurrentReactContext();
                // If it's constructed, send a notification
                if (context != null) {
                    LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(message);
                } else {
                    // Otherwise wait for construction, then send the notification
                    mReactInstanceManager.addReactInstanceEventListener(new ReactInstanceManager.ReactInstanceEventListener() {
                        public void onReactContextInitialized(ReactContext context) {
                            LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(message);
                        }
                    });
                    if (!mReactInstanceManager.hasStartedCreatingInitialContext()) {
                        // Construct it in the background
                        mReactInstanceManager.createReactContextInBackground();
                    }
                }
            }
        });
    }
}

Run Android Firebase error all of a sudden - Ionic Forum, error: cannot find symbol import com.google.firebase.iid.​FirebaseInstanceIdService; ^ symbol: class FirebaseInstanceIdService location:  So after updating the version of firebase-messaging in the build.gradle file from v17.0.0 to v17.1.0, strange things started happening…. there was a line of horror in service I used to use for messaging in my application.


no se puede encontrar el error de importación de com.google , cannot find symbol import com.google.firebase.iid.FirebaseInstanceIdService error in ionic3. I Have no idea why I am getting this error whenever I try to create  Called when the system determines that the tokens need to be refreshed. The application should call getToken() and send the tokens to all application servers.


public FirebaseInstanceIdService, de com.google.firebase.iid.FirebaseInstanceIdService en ionic3 Java:6: error​: cannot find symbol import com.google.firebase.iid.FirebaseInstanceIdService  Yes FirebaseInstanceIdService is deprecated. FROM DOCS :-This class was deprecated. In favour of overriding onNewToken in FirebaseMessagingService. Once that has been implemented, this service can be safely removed. No need to use FirebaseInstanceIdService service to get FCM token You can safely remove FirebaseInstanceIdService service


Base class to handle Firebase Instance ID token refresh events. Any app interested in the Instance ID, or using Instance ID tokens, can extend  See the cordova-plugin-firebasex-ionic3-test example project for a demonstration of how to use the plugin with Ionic 3.. Build environment notes PhoneGap Build. This plugin will not work with Phonegap Build (and other remote cloud build envs) do not support Cordova hook scripts as they are used by this plugin to configure the native platform projects.