在出现此错误之前,我将firebase-auth更新到版本16.0.2,以解决“程序类型已存在:com.google.android.gms.internal”错误。会相关吗?
崩溃日志:
> java.lang.NoSuchMethodError: No virtual method zzboy()Z in class
> Lcom/google/firebase/FirebaseApp; or its super classes (declaration of
> 'com.google.firebase.FirebaseApp' appears in
> /data/app/com.bignerdranch.android.instagramclone-1/split_lib_dependencies_apk.apk)
> at com.google.firebase.database.FirebaseDatabase.getInstance(Unknown Source)
> at com.google.firebase.database.FirebaseDatabase.getInstance(Unknown Source)
> at com.bignerdranch.android.instagramclone.Utils.FirebaseMethods.<init>(FirebaseMethods.java:57)
> at com.bignerdranch.android.instagramclone.Share.NextActivity.onCreate(NextActivity.java:49)
> at android.app.Activity.performCreate(Activity.java:6372)
> at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
> at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2432)
> at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2539)
> at android.app.ActivityThread.access$900(ActivityThread.java:168)
> at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1378)
> at android.os.Handler.dispatchMessage(Handler.java:102)
> at android.os.Looper.loop(Looper.java:150)
> at android.app.ActivityThread.main(ActivityThread.java:5659)
> at java.lang.reflect.Method.invoke(Native Method)
> at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:822)
> at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:712)
项目gradle:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.0.1'
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
google() // Google's Maven repository
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app gradle:
apply plugin: 'com.android.application' android { compileSdkVersion 26 buildToolsVersion '27.0.3' defaultConfig { applicationId "com.bignerdranch.android.instagramclone" minSdkVersion 19 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2',
{排除组:“ com.android.support”,模块:“ support-annotations” }) 实施'com.android.support:appcompat-v7:26.1.0' 实现'com.android.support.constraint:constraint-layout:1.0.2' testImplementation'junit:junit:4.12'
implementation 'com.google.firebase:firebase-core:16.0.1' //Design library for Coordinator Layout and Toolbars implementation 'com.android.support:design:26.1.0' //BottomNavigationViewEx Library implementation 'com.github.ittianyu:BottomNavigationViewEx:1.2.4' //Circle ImageView implementation 'de.hdodenhof:circleimageview:2.2.0' //Universal Image Loader implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5' //firebase authentication implementation 'com.google.firebase:firebase-auth:16.0.2' //firebase database implementation 'com.google.firebase:firebase-database:11.6.0' //firebase storage implementation 'com.google.firebase:firebase-storage:16.0.1' } //Firebase apply plugin: 'com.google.gms.google-services'
答案 0 :(得分:1)
我升级到4.2.0,并且可以正常工作
classpath 'com.google.gms:google-services:4.2.0'
答案 1 :(得分:0)
您对firebase-database的依赖确实很老。尝试使用最新版本:
implementation 'com.google.firebase:firebase-database:16.0.1'
每个依赖项的最新版本均为listed on this page。