簡體   English   中英

原因: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”

這是我的項目搖籃

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.1.0'

    }
}

allprojects {
    repositories {
        jcenter()

        maven {
            url 'https://maven.google.com/'
        }
        google()
    }
}

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

這是我的應用程式

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'
    defaultConfig {
        applicationId 'com.ramin.quiz'
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.google.firebase:firebase-database:11.8.0'
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    testImplementation 'junit:junit:4.12'
    //noinspection UseOfBundledGooglePlayServices
//    implementation 'com.google.android.gms:play-services-analytics:16.0.4'
    implementation 'com.google.android.gms:play-services:12.0.1'
    implementation 'com.mcxiaoke.volley:library:1.0.18'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.github.bluejamesbond:textjustify-android:2.1.1'
    implementation 'com.nineoldandroids:library:2.4.0'
    implementation 'com.daimajia.easing:library:1.0.1@aar'
    implementation 'com.daimajia.androidanimations:library:1.1.3@aar'
    //compile 'com.google.android.gms:play-services-appstate:7.3.0'
    implementation 'com.google.firebase:firebase-auth:16.0.5'
    implementation 'com.google.firebase:firebase-core:16.0.4'
    implementation 'com.facebook.android:facebook-android-sdk:4.38.0'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:multidex:1.0.3'

    implementation 'com.google.android.gms:play-services-ads:17.0.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'

    androidTestImplementation 'com.android.support:multidex-instrumentation:1.0.3'
}
apply plugin: 'com.google.gms.google-services'

這行在MainApplication.class上獲取錯誤

GoogleAnalytics analytics = GoogleAnalytics.getInstance(MainApplication.this);

這行在menuHomeScreenActivity.class上獲取錯誤

Tracker mTracker = application.getDefaultTracker();

我的logcat:

 10-27 19:55:14.008 17432-17432/com.ramin.quiz E/UncaughtException: java.lang.NoClassDefFoundError: Failed resolution of: 

LCOM /谷歌/機器人/克/普通/內部/ zzbq; 在com.google.android.gms.analytics.GoogleAnalytics.getInstance(未知來源:0)在com.google.android.gms.internal.zzark.zzbl(未知來源:0)在com.ramin.quiz.application.MainApplication com.ramin.quiz.activity.MenuHomeScreenActivity.onCreate( MenuHomeScreenActivity.java:153 )上的.getDefaultTracker( MainApplication.java:40 )android.app.Activity上的android.app.Activity.performCreate(Activity.java:7009)上的.getDefaultTracker( MainApplication.java:40 )。在android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)在perform.Create(Activity.java:7000)在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java :2856),位於android.app.ActivityThread.-wrap11(Unknown Source:0),位於android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1589),位於android.os.Handler.dispatchMessage(Handler.java:106)在android.os.Looper.loop(Looper.java:164)在android.app.ActivityThread.main(ActivityThread.java:6494)在java.lang.reflect.Method.inv 在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)處com.android.internal.os.RuntimeInit $ MethodAndArgsCaller.run(RuntimeInit.java:438)的oke(本機方法)造成原因:java。 lang.ClassNotFoundException:在路徑:DexPathList [[zip文件“ /data/app/com.ramin.quiz-RNjLhiGfgiVubfbHvVcKDQ==/base”中找不到類“ com.google.android.gms.common.internal.zzbq”。 apk”,zip文件“ /data/app/com.ramin.quiz-RNjLhiGfgiVubfbHvVcKDQ==/split_lib_dependencies_apk.apk”、zip文件“ /data/app/com.ramin.quiz-RNjLhiGfgiVubfbHvVcK_ap_aps”、“zip文件”。文件“ /data/app/com.ramin.quiz-RNjLhiGfgiVubfbHvVcKDQ==/split_lib_slice_0_apk.apk”,壓縮文件“ /data/app/com.ramin.quiz-RNjLhiGfgiVubfbHvVcKDQ==//split_ap_ap,zip”。 /app/com.ramin.quiz-RNjLhiGfgiVubfbHvVcKDQ==/split_lib_slice_2_apk.apk”、zip文件“ /data/app/com.ramin.quiz-RNjLhiGfgiVubfbHvVcKDQ==//split_lib_slice_3_ap” .ramin.quiz-RNjLhiGfgiVubfbHvVcKDQ == / split_lib_slice_4_apk.apk“,zip fil e“ /data/app/com.ramin.quiz-RNjLhiGfgiVubfbHvVcKDQ==/split_lib_slice_5_apk.apk",zip文件” /data/app/com.ramin.quiz-RNjLhiGfgiVubfbHvVcKDQ==//split_ap_apk“, /app/com.ramin.quiz-RNjLhiGfgiVubfbHvVcKDQ==/split_lib_slice_7_apk.apk”、zip文件“ /data/app/com.ramin.quiz-RNjLhiGfgiVubfbHvVcKDQ==//split_lib_slice_8” 。 com.google.android上的java.lang.ClassLoader.loadClass(ClassLoader.java:379)上的.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)。 gms.internal.zzark.zzbl(未知來源:0)位於com.google.android.gms.analytics.GoogleAnalytics.getInstance(未知來源:0)位於com.ramin.quiz.application.MainApplication.getDefaultTracker( MainApplication.java: 40 )在com.ramin.quiz.activity android.app.Activity.performCreate(Activity.java:7009)上的.MenuHomeScreenActivity.onCreate( MenuHomeScreenActivity.java:153 )android.app.Instrumentation.callActivityOnCreate()上的android.app.Activity.performCreate(Activity.java:7000) Instrumentation.java:1214)位於android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)位於android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)位於android.app.ActivityThread.-wrap11(未知來源:0 )在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1589)在android.os.Handler.dispatchMessage(Handler.java:106)在android.os.Looper.loop(Looper.java:164)在android .com.android.internal.os.RuntimeInit $ MethodAndArgsCaller.run(RuntimeInit.java:438)的java.lang.reflect.Method.invoke(本機方法)的.app.ActivityThread.main(ActivityThread.java:6494) .android.internal.os.ZygoteInit.main(ZygoteInit.java:807)禁止:java.io.IOException:找不到dex位置/ da的原始dex文件 TA /應用/ com.ramin.quiz-RNjLhiGfgiVubfbHvVcKDQ == / split_lib_resources_apk.apk

我並不總是工作,但請嘗試使用https://developer.android.com/studio/build/multidex 它適用於因大小而出錯的應用程序。

您可以將其添加到您的依賴項中:

dependencies { implementation 'com.android.support:multidex:1.0.3' }

有關更多說明,請閱讀鏈接的文章。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM