我已经在这里检查了先前的问题,它似乎是相互冲突的依赖关系,但是我似乎找不到错误
Error
06-23 16:41:14.542 7770-7770/net.simplifiedlearning.firebaseauth E/AndroidRuntime: FATAL EXCEPTION: main
Process: net.simplifiedlearning.firebaseauth, PID: 7770
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/zzbq;
at com.google.firebase.storage.FirebaseStorage.getInstance(Unknown Source:11)
at net.simplifiedlearning.firebaseauth.ProfileActivity.uploadImageToFirebaseStorage(ProfileActivity.java:250)
at net.simplifiedlearning.firebaseauth.ProfileActivity.onActivityResult(ProfileActivity.java:240)
at android.app.Activity.dispatchActivityResult(Activity.java:7235)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4335)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4382)
at android.app.ActivityThread.-wrap19(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1654)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:251)
at android.app.ActivityThread.main(ActivityThread.java:6572)
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)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.internal.zzbq" on path: DexPathList[[zip file "/data/app/net.simplifiedlearning.firebaseauth-kxzC1xsQNY2FvbVhXuPXPg==/base.apk"],nativeLibraryDirectories=[/data/app/net.simplifiedlearning.firebaseauth-kxzC1xsQNY2FvbVhXuPXPg==/lib/arm64, /system/lib64, /system/vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.google.firebase.storage.FirebaseStorage.getInstance(Unknown Source:11)
at net.simplifiedlearning.firebaseauth.ProfileActivity.uploadImageToFirebaseStorage(ProfileActivity.java:250)
at net.simplifiedlearning.firebaseauth.ProfileActivity.onActivityResult(ProfileActivity.java:240)
at android.app.Activity.dispatchActivityResult(Activity.java:7235)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4335)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4382)
at android.app.ActivityThread.-wrap19(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1654)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:251)
at android.app.ActivityThread.main(ActivityThread.java:6572)
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)
Build.gradle模块:应用
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "net.simplifiedlearning.firebaseauth"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.android.support:support-vector-drawable:27.1.1'
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.github.bumptech.glide:glide:4.7.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
implementation 'com.android.support:appcompat-v7:26.1.1'
implementation 'com.android.support:design:26.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.firebase:firebase-client-android:2.5.2'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
//maps
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
compile 'com.google.android.gms:play-services-ads:15.0.1'
//personal firebase database
implementation 'com.firebaseui:firebase-ui-database:3.3.1'
implementation 'com.firebaseui:firebase-ui-auth:3.3.1'
implementation 'com.android.support:multidex:1.0.3'
api 'com.google.firebase:firebase-messaging:17.0.0'
}
//apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.gms.google-services'
这是我的build.gradle项目:appname:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// 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()
mavenCentral()
maven { url 'https://maven.google.com' }
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
构建成功,但是当我尝试为链接到Firebase的个人资料选择图像时,它会崩溃。
答案 0 :(得分:1)
不确定是否可以使用,但是请尝试将以下内容添加到gradle.properties文件中:
googlePlayServicesVersion=11.0.4
遇到相同错误时为我工作。