Android 3.1.1-无法解决以下问题:Lcom / google / android / gms / common / internal / zzbq; [英] Android 3.1.1 - Failed resolution of: Lcom/google/android/gms/common/internal/zzbq;

查看:522
本文介绍了Android 3.1.1-无法解决以下问题:Lcom / google / android / gms / common / internal / zzbq;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于我已更新至Android Studio 3.1,因此我的项目不再运行。我在整个互联网上都在寻找解决方案,但没有取得积极的结果。
这是我在Logcat中遇到的错误:

since I've updated to Android Studio 3.1, my project is not running anymore. I have searched for a solution all over the internet with no positive results. Here's the error I get in the Logcat:

 --------- beginning of crash
04-13 13:33:55.466 12720-12720/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: woopy.domain.com.woopy, PID: 12720
    java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/zzbq;
        at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source:2)
        at android.app.ActivityThread.installProvider(ActivityThread.java:6239)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:5805)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5722)
        at android.app.ActivityThread.-wrap1(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.internal.zzbq" on path: DexPathList[[zip file "/data/app/woopy.domain.com.woopy-KqNv1gE1ZomaesHCq33DJw==/base.apk"],nativeLibraryDirectories=[/data/app/woopy.domain.com.woopy-KqNv1gE1ZomaesHCq33DJw==/lib/x86, /system/lib, /vendor/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source:2) 
        at android.app.ActivityThread.installProvider(ActivityThread.java:6239) 
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:5805) 
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5722) 
        at android.app.ActivityThread.-wrap1(Unknown Source:0) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:164) 
        at android.app.ActivityThread.main(ActivityThread.java:6494) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 
04-13 13:33:55.567 12720-12727/? I/zygote: Debugger is no longer active

这是我的build.gradle(Module:app )文件:

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.3"
    defaultConfig {
        applicationId "woopy.domain.com.woopy"
        minSdkVersion 21
        targetSdkVersion 27
        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 {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.squareup.okhttp3:okhttp:3.10.0'
    //noinspection GradleCompatible
    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'
    testImplementation 'junit:junit:4.12'
    implementation 'com.parse:parse-android:+'
    implementation 'com.parse.bolts:bolts-android:1.+'
    //noinspection GradleCompatible
    implementation 'com.google.android.gms:play-services-maps:+'
    implementation 'com.google.android.gms:play-services-auth:12.0.1'
    implementation 'com.google.android.gms:play-services-location:12.0.1'
    implementation 'com.google.android.gms:play-services:+'
    implementation 'com.google.android.gms:play-services-ads:+'
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'com.facebook.android:facebook-android-sdk:4.+'
    implementation 'com.parse:parsefacebookutils-v4-android:1.10.3@aar'
    implementation 'com.commit451:PhotoView:1.2.4'

}

这是我的build.gradle(项目:应用程序名称):

buildscript {
    repositories {
        jcenter()
        maven { url 'https://maven.google.com' }
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url "https://maven.google.com" }
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
}

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

构建成功,但应用在启动时崩溃。

The Build is successful, but the app crashes at startup.

编辑:
现在它不再能够成功构建,它在构建消息控制台中引发了这个绝对奇怪的错误:

It doesn't build successful anymore now, it throws this absolutely weird error in the Build message console:

AGPBI: {"kind":"error","text":"Program type already present: com.google.android.gms.location.places.zza","sources":[{}],"tool":"D8"}
:app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'


$执行失败b $ b

.

推荐答案

尝试将此依赖项添加到gradle文件中:

Try adding this dependency to your gradle file:

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

此外,您应该对支持和播放服务库使用相同的版本。而且,您应该避免使用 + 作为最新版本。更改此部分:

Also you should use the same versions for the support and play services libraries. And you should avoid using "+" for latest version. Change this part:

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

为此:

implementation 'com.google.android.gms:play-services-maps:12.0.1'
implementation 'com.google.android.gms:play-services-auth:12.0.1'
implementation 'com.google.android.gms:play-services-location:12.0.1'
implementation 'com.google.android.gms:play-services:12.0.1'
implementation 'com.google.android.gms:play-services-ads:12.0.1'




编辑:您也可以将此部分添加到应用程序级别的gradle文件中,然后重试。我没有看到任何人尝试过此方法,但它可能有效。

You may also add this part to your app level gradle file and try again. I did not see anyone tried this but it may work.



allprojects {
    repositories {
       //...
    }

    subprojects {
        project.configurations.all {
            resolutionStrategy.eachDependency { details ->
                if (details.requested.group == 'com.google.android.gms'
                && !details.requested.name.contains('multidex') ) {
                    details.useVersion "12.0.1"
                }
            }
        }
    }
}




第二次更新:刚看到了这一点,下面的依赖项覆盖了所有其他依赖项,因此可能导致重复问题。删除其他依赖项并保留以下依赖项:

2ND UPDATE: Just seen this, the dependency below, covers all the others, then it may cause a duplication issue. Remove the other dependencies and leave this one:



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

这篇关于Android 3.1.1-无法解决以下问题:Lcom / google / android / gms / common / internal / zzbq;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆