简体   繁体   English

ClassNotFoundException找不到类“ com.google.android.gms.common.internal.zzbq

[英]ClassNotFoundException Didn't find class "com.google.android.gms.common.internal.zzbq

I have to store file in firebase storage. 我必须将文件存储在Firebase存储中。

My Gradle File: 我的Gradle文件:

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.deadbrains.propertymanagement"
        minSdkVersion 18
        targetSdkVersion 27
        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'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.volley:volley:1.1.0'
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.github.jineshfrancs:CaptchaImageView:1.0'
    implementation 'com.google.code.gson:gson:2.8.1'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.google.firebase:firebase-storage:11.8.0'
    implementation 'com.google.firebase:firebase-firestore:11.8.0'
    implementation 'com.google.firebase:firebase-core:16.0.9'
    implementation 'com.google.firebase:firebase-messaging:18.0.0'
    implementation 'com.google.firebase:firebase-auth:17.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation('com.crashlytics.sdk.android:crashlytics:2.10.1@aar') {
        transitive = true;
    }
}
apply plugin: 'com.google.gms.google-services' 

Here's my build.gradle (Project: appname): 这是我的build.gradle(项目:appname):

buildscript {

    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath 'com.google.gms:google-services:4.0.2'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}     

When i am uploading file error occur. 当我上传文件时发生错误。 This is my code for uploading file 这是我上传文件的代码

private void uploadFile() {
        if (filePath != null) {
            pDialog = ProgressDialog.show( AddNoticeActivity.this ,"" ,"Wait..." ,false ,false );

            StorageReference riversRef = null;
            if (extension.equals( "docx" ) || extension.equals( "doc" )) {
                Random Number = new Random();
                int Rnumber = Number.nextInt( 100000 );
                String name = "doc" + Rnumber;
                riversRef = FirebaseStorage.getInstance().getReference().child( "Notice/" + name );
            } else if (extension.equals( "pdf" )) {
                Random Number = new Random();
                int Rnumber = Number.nextInt( 100000 );
                String name = "pdf" + Rnumber;
                riversRef = FirebaseStorage.getInstance().getReference().child( "Notice/" + name );
            } else {
                Random Number = new Random();
                int Rnumber = Number.nextInt( 100000 );
                String name = "pic" + Rnumber;
                riversRef = FirebaseStorage.getInstance().getReference().child( "Notice/" + name );
            }
            strAttachment = riversRef.getPath();
            Log.d( "storage path : " ,strAttachment );

            riversRef.putFile( filePath )
                    .addOnSuccessListener( new OnSuccessListener <UploadTask.TaskSnapshot>() {
                        @Override
                        public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
                            callAddNoticeService();
                        }
                    } )
                    .addOnFailureListener( new OnFailureListener() {
                        @Override
                        public void onFailure(@NonNull Exception exception) {
                            Log.d( "Error" ,exception.getMessage() );
                            Toast.makeText( getApplicationContext() ,exception.getMessage() ,Toast.LENGTH_LONG ).show();
                        }
                    } )
                    .addOnProgressListener( new OnProgressListener <UploadTask.TaskSnapshot>() {
                        @Override
                        public void onProgress(UploadTask.TaskSnapshot taskSnapshot) {

                        }
                    } );
        }
    }

It shows error at line 它在行显示错误

     riversRef = FirebaseStorage.getInstance().getReference().child( "Notice/" + name );

Error is 错误是

Fatal Exception: java.lang.NoClassDefFoundError Failed resolution of: Lcom/google/android/gms/common/internal/zzbq; 致命异常:java.lang.NoClassDefFoundError无法解决以下问题:Lcom / google / android / gms / common / internal / zzbq;

When I upgrade the dependencies and it shows error : 当我升级依赖项时,它显示错误:

error: resource android:attr/fontVariationSettings not found. 错误:找不到资源android:attr / fontVariationSettings。 Message{kind=ERROR, text=error: resource android:attr/fontVariationSettings not found. 消息{种类=错误,文本=错误:未找到资源android:attr / fontVariationSettings。

error: resource android:attr/ttcIndex not found. 错误:找不到资源android:attr / ttcIndex。 Message{kind=ERROR, text=error: resource android:attr/ttcIndex not found. 消息{种类=错误,文本=错误:找不到资源android:attr / ttcIndex。

Upgrade the following dependencies: 升级以下依赖项:

 implementation 'com.google.firebase:firebase-storage:11.8.0'
 implementation 'com.google.firebase:firebase-firestore:11.8.0'
 implementation 'com.google.firebase:firebase-core:16.0.9'
 implementation 'com.google.firebase:firebase-messaging:18.0.0'
 implementation 'com.google.firebase:firebase-auth:17.0.0'

into this: 到这个:

 implementation 'com.google.firebase:firebase-storage:19.0.0'
 implementation 'com.google.firebase:firebase-firestore:21.0.0'
 implementation 'com.google.firebase:firebase-core:17.2.0'
 implementation 'com.google.firebase:firebase-messaging:20.0.0'
 implementation 'com.google.firebase:firebase-auth:19.0.0'

Check the latest version in the following link: 在以下链接中检查最新版本:

https://firebase.google.com/support/release-notes/android https://firebase.google.com/support/release-notes/android

After you update the dependencies you need to migrate you androidx , you can find how in the following link : 更新依赖项后,您需要迁移androidx ,您可以在以下链接中找到操作方法:

https://stackoverflow.com/a/57005161/7015400 https://stackoverflow.com/a/57005161/7015400

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 原因:java.lang.ClassNotFoundException:找不到类“ com.google.android.gms.common.internal.zzbq” - Caused by: java.lang.ClassNotFoundException: Didn't find class “com.google.android.gms.common.internal.zzbq” 放置自动完成未找到类“ com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable” - Places AutoComplete Didn't find class “com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable” 由java.lang.ClassNotFoundException引起找不到类“ com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver - Caused by java.lang.ClassNotFoundException Didn't find class "com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver java.lang.ClassNotFoundException:未找到类“com.google.android.gms.ads.MobileAdsInitProvider” - java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.MobileAdsInitProvider" ClassNotFoundException:未找到类“com.google.android.gms.ads.AdView” - ClassNotFoundException: Didn't find class “com.google.android.gms.ads.AdView” 没找到上课“com.google.android.gms.common.app.GmsApplication” - Didn't find class “com.google.android.gms.common.app.GmsApplication” java.lang.ClassNotFoundException:在路径上找不到类“com.google.android.gms.measurement.AppMeasurementJobService”:DexPathList - java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.measurement.AppMeasurementJobService" on path: DexPathList java.lang.ClassNotFoundException:在路径:DexPathList上找不到类“ com.google.android.gms.dynamic.zzf” - java.lang.ClassNotFoundException: Didn't find class “com.google.android.gms.dynamic.zzf” on path: DexPathList 无法解决以下问题:位于com.google.firebase.storage.FirebaseStorage.getInstance的Lcom / google / android / gms / common / internal / zzbq;(未知来源) - Failed resolution of: Lcom/google/android/gms/common/internal/zzbq;at com.google.firebase.storage.FirebaseStorage.getInstance(Unknown Source) 将 targetSdkVersion 提高到 28 时,在路径上找不到类“com.google.android.gms.common.R$string”:DexPathList - When raising targetSdkVersion to 28, Didn't find class "com.google.android.gms.common.R$string" on path: DexPathList
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM