自从我添加Firebase
进行分析以来,我一直遇到问题。我花了几个小时试图找到解决方案但没有任何效果。我得到的错误是
java.lang.NoSuchMethodError: No static method zzcL(Ljava/lang/String;)Z in class Lcom/google/android/gms/common/util/zzt; or its super classes (declaration of 'com.google.android.gms.common.util.zzt' appears in /data/app/ist311njb.sustainability-WtBugfLSabsasKVrqCVeyw==/base.apk)
at com.google.firebase.FirebaseOptions.<init>(Unknown Source:4)
at com.google.firebase.FirebaseOptions.fromResource(Unknown Source:62)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source:15)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source:4)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1919)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1894)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source:17)
at android.app.ActivityThread.installProvider(ActivityThread.java:6285)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5851)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5772)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
我有
classpath 'com.google.gms:google-services:3.1.0'` and `repositories {
maven { url 'https://maven.google.com'}
}
在我的根build.gradle
中,我的应用build.gradle是
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public'}
}
android {
compileSdkVersion 25
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "ist311njb.sustainability"
minSdkVersion 23
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled true
}
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.google.guava:guava:20.0'
compile 'com.google.code.gson:gson:2.8.2'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:cardview-v7:25.3.1'
compile('com.crashlytics.sdk.android:crashlytics:2.7.1@aar'){
transitive = true;
}
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services-gcm:11.0.4'
compile 'com.google.android.gms:play-services-base:11.0.4'
compile 'com.google.firebase:firebase-core:11.0.4'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
答案 0 :(得分:0)
试试这个我发现:将force = true;
放在gradle中的以下内容中:
compile ('com.google.android.gms:play-services-ads:9.6.1') {
force = true;
}
compile ('com.google.android.gms:play-services-gcm:9.6.1') {
force = true;
}