FirebaseAuth - Compat problems (java.lang.NoSuchMethodError: No virtual method zzUV())
FirebaseAuth - Compat problems (java.lang.NoSuchMethodError: No virtual method zzUV())
我有一个 android 项目,自从我添加:
火力地堡授权。
我做了什么:
将 google-services.json 添加到应用级文件夹
在 build.gradle(顶级)中添加了 classpath 'com.google.gms:google-services:3.0.0'
这是我的 build.gradle 内容(应用级别)
这里是:
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "xxxx.xxx.xxx"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
debug {
debuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:support-v4:25.1.0'
compile 'com.google.android.gms:play-services-base:10.2.1'
compile 'com.google.android.gms:play-services-maps:10.2.1'
compile 'com.google.android.gms:play-services-location:10.2.1'
compile 'com.google.firebase:firebase-auth:10.2.1'
compile 'com.android.support:recyclerview-v7:25.1.0'
compile 'com.android.support:cardview-v7:25.1.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
这是崩溃时的堆栈跟踪:
FATAL EXCEPTION: main Process: xxx.xxxx, PID: 8425
java.lang.NoSuchMethodError: No virtual method zzUV()Ljava/lang/String; in
class Lcom/google/firebase/FirebaseApp; or its super classes (declaration of
'com.google.firebase.FirebaseApp' appears in /data/app/xxx.xxx-2/base.apk)
at com.google.firebase.auth.FirebaseAuth.zzd(Unknown Source)
at com.google.firebase.auth.FirebaseAuth.zzc(Unknown Source)
at com.google.firebase.auth.FirebaseAuth.getInstance(Unknown Source)
at xxx.xxxx.LoginActivity.onCreate(LoginActivity.java:82)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
尝试使用较低版本的身份验证,例如
compile 'com.google.firebase:firebase-auth:9.8.0'
或类似 9.9.0
等
就我而言,问题是我的 google 播放服务 sdk 没有安装在 android 工作室中。安装后,我清理了项目,一切正常。
添加 firebase 核心库compile 'com.google.firebase:firebase-core:10.2.1'
我有一个 android 项目,自从我添加: 火力地堡授权。
我做了什么:
将 google-services.json 添加到应用级文件夹
在 build.gradle(顶级)中添加了
classpath 'com.google.gms:google-services:3.0.0'
这是我的 build.gradle 内容(应用级别)
这里是:
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "xxxx.xxx.xxx"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
debug {
debuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:support-v4:25.1.0'
compile 'com.google.android.gms:play-services-base:10.2.1'
compile 'com.google.android.gms:play-services-maps:10.2.1'
compile 'com.google.android.gms:play-services-location:10.2.1'
compile 'com.google.firebase:firebase-auth:10.2.1'
compile 'com.android.support:recyclerview-v7:25.1.0'
compile 'com.android.support:cardview-v7:25.1.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
这是崩溃时的堆栈跟踪:
FATAL EXCEPTION: main Process: xxx.xxxx, PID: 8425
java.lang.NoSuchMethodError: No virtual method zzUV()Ljava/lang/String; in
class Lcom/google/firebase/FirebaseApp; or its super classes (declaration of
'com.google.firebase.FirebaseApp' appears in /data/app/xxx.xxx-2/base.apk)
at com.google.firebase.auth.FirebaseAuth.zzd(Unknown Source)
at com.google.firebase.auth.FirebaseAuth.zzc(Unknown Source)
at com.google.firebase.auth.FirebaseAuth.getInstance(Unknown Source)
at xxx.xxxx.LoginActivity.onCreate(LoginActivity.java:82)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
尝试使用较低版本的身份验证,例如
compile 'com.google.firebase:firebase-auth:9.8.0'
或类似 9.9.0
等
就我而言,问题是我的 google 播放服务 sdk 没有安装在 android 工作室中。安装后,我清理了项目,一切正常。
添加 firebase 核心库compile 'com.google.firebase:firebase-core:10.2.1'