我在现有项目中遇到了firebase getInstanceId()问题。这是完整的错误以及我正在使用的依赖项。
java.lang.NoSuchMethodError:没有虚拟方法getInstanceId()Lcom / google / android / gms / tasks / Task;在Lcom / google / firebase / iid / FirebaseInstanceId类中;或其上级类(app / com.xx.xxx.staging.dev-2 / split_lib_dependencies_apk.apk)
此行发生错误
MixpanelAPI mixpanel =
MixpanelAPI.getInstance(context, BuildConfig.MIXPANEL_TOKEN);
模块-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
}
}
您能建议我在这里错过什么吗?
谢谢 R