简体   繁体   中英

Caused by: java.lang.ClassNotFoundException: Didn't find class “com.google.android.gms.common.internal.zzbq” on path

I am facing this issue while building my project. I am not able to solve it by updating the play services to 16.0.0 as well as to 15.0.0

The Error is below:

Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.internal.zzbq" on path: DexPathList[[zip file]]

Project level build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        //classpath 'com.google.gms:google-services:3.2.1'
        classpath 'com.google.gms:google-services:4.0.1'


        // google-services plugin


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

allprojects {
    repositories {
        google()
        jcenter()

    }
}


ext {
    library_play_service_version = '12.0.1'
}


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

App level build.gradle

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
    compileSdkVersion 26
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "in.greylabs.beacondriver"
        minSdkVersion 14
        targetSdkVersion 26
        versionCode 5
        versionName "1.0.4"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

afterEvaluate {
    tasks.matching {
        it.name.startsWith('dex')
    }.each { dx ->
        if (dx.additionalParameters == null) {
            dx.additionalParameters = ['--multi-dex']
        } else {
            dx.additionalParameters += '--multi-dex'
        }
    }
}

repositories {
    maven {
        url "http://hypertrack-android-sdk.s3-website-us-west-2.amazonaws.com/"
    }
    maven { url 'https://maven.google.com' }
    maven { url 'https://maven.fabric.io/public' }
}

ext {
    supportVersion = '27.1.1'
    playServicesVersion = '12.0.1'
    butterKnifeVersion = '8.8.1'
    glideVersion = '3.7.0'
}




dependencies {
    //noinspection GradleCompatible
    implementation 'com.android.support:support-v4:26.1.0'
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    //HyperTrack: HyperTrack library
    implementation('com.hypertrack:android:0.7.16@aar') {
        transitive = true;
    }
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.android.support:cardview-v7:26.1.0'
    //noinspection UseOfBundledGooglePlayServices
    implementation 'com.google.android.gms:play-services:12.0.1'
    implementation 'com.google.android.gms:play-services-analytics:16.0.0'
    implementation "com.google.firebase:firebase-core:16.0.0"

    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.8.1'
    implementation 'com.squareup.okhttp3:okhttp:3.9.0'
    implementation 'com.github.bumptech.glide:glide:4.6.1'
    implementation 'jp.wasabeef:glide-transformations:3.0.1'
    testImplementation 'junit:junit:4.12'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.1.1'
    implementation( 'com.crashlytics.sdk.android:crashlytics:2.7.1@aar' ) {
        transitive = true
    }
}
apply plugin: 'com.google.gms.google-services'

This is because you have multiple version of Google Play Services with the following dependencies:

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

So, you need to remove the following:

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

And use only one version of the library:

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

Please remember that you're adding the whole Play Services by adding the above dependency. You should only use only the library that you want. Read more at https://developers.google.com/android/guides/setup

try add this part to your top level gradle:

allprojects {
    repositories {
        google()
        jcenter()
        .
        .
        .
        maven { url 'http://hypertrack-core-android.s3-website-us-east-1.amazonaws.com/' }
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM