0

I am facing an issue with firebase getInstanceId() in existing project.here is the full error and the dependencies I am using.

java.lang.NoSuchMethodError: No virtual method getInstanceId()Lcom/google/android/gms/tasks/Task; in class Lcom/google/firebase/iid/FirebaseInstanceId; or its super classes (app/com.xx.xxx.staging.dev-2/split_lib_dependencies_apk.apk)

Error occurs on this line

MixpanelAPI mixpanel =
                MixpanelAPI.getInstance(context, BuildConfig.MIXPANEL_TOKEN);

module - build.gradle

buildscript {
repositories {
    mavenCentral()
    jcenter()
    google()
    maven { url 'https://maven.fabric.io/public' }
    maven {url "https://clojars.org/repo/"}
}

dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'
    classpath "com.fernandocejas.frodo:frodo-plugin:0.8.1"
    classpath 'me.tatarka:gradle-retrolambda:3.2.3'
    classpath "io.realm:realm-gradle-plugin:3.5.0"
    classpath 'com.google.gms:google-services:3.2.1' // google-services plugin
}
}

    android {
        compileSdkVersion 27
        buildToolsVersion '27.0.0'
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
        defaultConfig {
            applicationId "com.xx.xxx"
            minSdkVersion 21
            targetSdkVersion 27

    dependencies {

    implementation 'com.google.firebase:firebase-messaging:15.0.0'
    }


    apply plugin: 'com.google.gms.google-services'

project build.gradle

buildscript {

    repositories {
        jcenter()
        google()
        maven { url 'http://repo1.maven.org/maven2' }
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
       // classpath "io.realm:realm-gradle-plugin:3.0.0"
       // classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        classpath "com.fernandocejas.frodo:frodo-plugin:0.8.1"
        classpath 'com.frogermcs.androiddevmetrics:androiddevmetrics-plugin:0.4'
        classpath 'com.google.gms:google-services:3.2.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

could you please suggest am I missing anything here?

thanks R

BRDroid
  • 3,920
  • 8
  • 65
  • 143
  • why you configure the `buildscript` twice and how shall these `build.gradle` be related to a a Java error message? better update your FCM code not to use that obsoleted method ... – Martin Zeitler Apr 25 '19 at 10:56
  • It is an error message related to firebase so I had a question like am I using the wrong version firebase – BRDroid Apr 25 '19 at 11:06
  • Possible duplicate of [FirebaseInstanceIdService is deprecated](https://stackoverflow.com/questions/51123197/firebaseinstanceidservice-is-deprecated) – Martin Zeitler Apr 25 '19 at 11:29
  • Hi BRDroid, have you find a solution for this? I'm facing exactly the same issue here... – Guillermo Gerard Sep 05 '19 at 18:41

0 Answers0