在路径:DexPathList

时间:2018-07-22 16:43:24

标签: android gradle

我的Gradle文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.1'
    defaultConfig {
        applicationId "com.mystorie.totheworld"
        minSdkVersion 17
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        // Enabling multidex support.
        multiDexEnabled true

        aaptOptions { cruncherEnabled = false }

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    dexOptions { javaMaxHeapSize "4g" }

}

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.squareup.okhttp3:okhttp:+'
    //noinspection GradleCompatible
    compile 'com.android.support:appcompat-v7:26.1.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.parse:parse-android:+'
    compile 'com.parse.bolts:bolts-android:1.+'
    //noinspection GradleCompatible
    compile 'com.google.android.gms:play-services:+'
    compile 'com.google.android.gms:play-services-ads:+'
    compile 'de.hdodenhof:circleimageview:2.2.0'
    compile 'com.facebook.android:facebook-android-sdk:4.+'
    compile 'com.parse:parsefacebookutils-v4-android:1.10.3@aar'
    compile 'com.google.android.gms:play-services-gcm:+'
    testCompile 'junit:junit:4.12'
}

这是我收到的错误

  

E / Android运行时:致命异常:主要                     程序:com.mystorie.totheworld,PID:16152                     java.lang.NoClassDefFoundError:无法解决以下问题:Lcom / google / android / gms / common / internal / zzbq;                         在com.google.firebase.provider.FirebaseInitProvider.attachInfo(未知   资源)                         在android.app.ActivityThread.installProvider(ActivityThread.java:6420)                         在android.app.ActivityThread.installContentProviders(ActivityThread.java:6012)                         在android.app.ActivityThread.handleBindApplication(ActivityThread.java:5951)                         在android.app.ActivityThread.-wrap3(ActivityThread.java)                         在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1710)                         在android.os.Handler.dispatchMessage(Handler.java:102)                         在android.os.Looper.loop(Looper.java:154)                         在android.app.ActivityThread.main(ActivityThread.java:6776)                         在java.lang.reflect.Method.invoke(本机方法)                         在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:1518)                         在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)                      原因:java.lang.ClassNotFoundException:在路径上找不到类“ com.google.android.gms.common.internal.zzbq”。   DexPathList [[zip文件“ /data/app/com.mystorie.totheworld-1/base.apk”,   压缩文件   “ /data/app/com.mystorie.totheworld-1/split_lib_dependencies_apk.apk”,   压缩文件   “ /data/app/com.mystorie.totheworld-1/split_lib_slice_0_apk.apk”,邮政编码   文件“ /data/app/com.mystorie.totheworld-1/split_lib_slice_1_apk.apk”,   压缩文件   “ /data/app/com.mystorie.totheworld-1/split_lib_slice_2_apk.apk”,邮政编码   文件“ /data/app/com.mystorie.totheworld-1/split_lib_slice_3_apk.apk”,   压缩文件   “ /data/app/com.mystorie.totheworld-1/split_lib_slice_4_apk.apk”,邮政编码   文件“ /data/app/com.mystorie.totheworld-1/split_lib_slice_5_apk.apk”,   压缩文件   “ /data/app/com.mystorie.totheworld-1/split_lib_slice_6_apk.apk”,邮政编码   文件“ /data/app/com.mystorie.totheworld-1/split_lib_slice_7_apk.apk”,   压缩文件   “ /data/app/com.mystorie.totheworld-1/split_lib_slice_8_apk.apk”,邮政编码   文件   “ /data/app/com.mystorie.totheworld-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.mystorie.totheworld-1/lib/arm,   / system / lib,/ vendor / lib]]                         在dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)                         在java.lang.ClassLoader.loadClass(ClassLoader.java:380)                         在java.lang.ClassLoader.loadClass(ClassLoader.java:312)                         在com.google.firebase.provider.FirebaseInitProvider.attachInfo(未知   资源)                         在android.app.ActivityThread.installProvider(ActivityThread.java:6420)                         在android.app.ActivityThread.installContentProviders(ActivityThread.java:6012)                         在android.app.ActivityThread.handleBindApplication(ActivityThread.java:5951)                         在android.app.ActivityThread.-wrap3(ActivityThread.java)                         在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1710)                         在android.os.Handler.dispatchMessage(Handler.java:102)                         在android.os.Looper.loop(Looper.java:154)                         在android.app.ActivityThread.main(ActivityThread.java:6776)                         在java.lang.reflect.Method.invoke(本机方法)                         在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:1518)                         在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)   与目标VM断开连接,地址:“ localhost:8600”,传输:   'socket'

3 个答案:

答案 0 :(得分:1)

我遇到了这个问题,由于有了其他答案,我得以解决。

Android 3.1.1 - Failed resolution of: Lcom/google/android/gms/common/internal/zzbq

问题是gradle文件中缺少此依赖项

implementation 'com.android.support:multidex:1.0.3'

答案 1 :(得分:0)

这是因为您拥有多个具有以下依赖性的Google Play服务版本:

implementation 'com.google.android.gms:play-services:12.0.1'
implementation 'com.google.android.gms:play-services-ads:+'

因此,您需要删除以下内容:

implementation 'com.google.android.gms:play-services:12.0.1'

并仅使用该库的一个版本:

implementation 'com.google.android.gms:play-services-ads:+'

应该删除您的错误

答案 2 :(得分:0)

如果您将项目更新为AndroidX。

然后删除

implementation 'com.google.android.gms:play-services:12.0.1'

并确保您所有的com.google.android.gms依赖项都是相同的版本。