android – After upgrading to google play services 8.4.0 my app crashes on startup-ThrowExceptions

Exception or error:

I’ve been previously using google play services 8.3.0 without any issue. I’m looking to upgrade to google play services 8.4.0. I’m using the following play libraries:

compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'

When I start the app it crashes, with the following log.

12-27 03:01:33.915 20567-20567/com.ryanc.android.stage.debug E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.ryanc.android.stage.debug, PID: 20567
    java.lang.NoSuchMethodError: No static method zzz(Ljava/lang/Object;)Ljava/lang/Object; in class Lcom/google/android/gms/common/internal/zzx; or its super classes (declaration of 'com.google.android.gms.common.internal.zzx' appears in /data/app/com.ryanc.android.stage.debug-1/base.apk:classes17.dex)
    at com.google.android.gms.measurement.internal.zzw.zzaT(Unknown Source)
    at com.google.android.gms.measurement.AppMeasurementContentProvider.onCreate(Unknown Source)
    at android.content.ContentProvider.attachInfo(ContentProvider.java:1696)
    at android.content.ContentProvider.attachInfo(ContentProvider.java:1671)
    at android.app.ActivityThread.installProvider(ActivityThread.java:4999)
    at android.app.ActivityThread.installContentProviders(ActivityThread.java:4594)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4534)
    at android.app.ActivityThread.access$1500(ActivityThread.java:151)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5254)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

Edit: Not sure it’ll help, but at @gerardnimo request here is the full build.gradle file. Also worth noting I have tried a clean build and deleting and reinstalling play services sdks from my computer.

apply plugin: 'com.android.application'
apply plugin: 'checkstyle'

def SDK = "$MIN_SDK_VERSION"
def V_CODE = "$VERSION_CODE"

buildscript {
    repositories {
        mavenCentral()
    }
}

repositories {
    mavenCentral()
    jcenter()
    maven { url 'https://zendesk.artifactoryonline.com/zendesk/repo' }
    maven { url "http://kahuna.github.io/kahuna-android/sdk" }
}

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.2'
    defaultConfig {
        applicationId "com.ryanc.android"
        minSdkVersion SDK.toInteger()
        targetSdkVersion 23
        versionCode V_CODE.toInteger()
        versionName "$APP_VERSION.$BUILD_NUMBER"
        multiDexEnabled true
    }
    signingConfigs {
        debug {
            storeFile file("$DEBUG_KEYSTORE_PATH")
            storePassword "$DEBUG_KEYSTORE_PASSWORD"
            keyAlias "$DEBUG_KEY_ALIAS"
            keyPassword "$DEBUG_KEY_PASSWORD"
        }
        release {
            storeFile file("$KEYSTORE_PATH")
            storePassword "$KEYSTORE_PASSWORD"
            keyAlias "$KEY_ALIAS"
            keyPassword "$KEY_PASSWORD"
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    buildTypes {
        debug {
            applicationIdSuffix ".debug"
        }
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
    }
    productFlavors {
        prod {
            applicationId "com.ryanc.android"
        }

        stage {
            applicationId "com.ryanc.android.stage"
        }

        qa {
            applicationId "com.ryanc.android.qa"
        }

        dev {
            applicationId "com.ryanc.android.dev"
        }
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
}

repositories {
    flatDir {
        dirs 'libs'
    }
}

dependencies {
    def supportVersion = "23.1.1"

    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':api')
    compile "com.android.support:support-v4:$supportVersion"
    compile "com.android.support:appcompat-v7:$supportVersion"
    compile "com.android.support:design:$supportVersion"
    compile 'com.facebook.android:facebook-android-sdk:4.8.1'
    compile 'uk.co.chrisjenx:calligraphy:2.0.1'
    compile "com.android.support:cardview-v7:$supportVersion"
    compile "com.android.support:recyclerview-v7:$supportVersion"
    compile "com.android.support:support-v13:$supportVersion"
    compile 'com.google.android.gms:play-services-analytics:8.4.0'
    compile 'com.google.android.gms:play-services-location:8.4.0'
    compile 'com.google.android.gms:play-services-gcm:8.4.0'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.4.5'
    compile 'com.fasterxml.jackson.core:jackson-core:2.4.5'
    compile 'com.fasterxml.jackson.core:jackson-annotations:2.4.5'
    compile 'joda-time:joda-time:2.5'
    compile 'com.squareup.retrofit:retrofit:1.7.1'
    compile 'com.squareup.okhttp:okhttp-urlconnection:2.5.0'
    compile 'com.squareup.okhttp:okhttp:2.5.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.netflix.rxjava:rxjava-core:0.20.7'
    compile 'com.netflix.rxjava:rxjava-android:0.20.7'
    compile 'com.squareup.dagger:dagger:1.2.2'
    compile 'com.squareup.mortar:mortar:0.16'
    compile 'com.squareup.flow:flow:0.8'
    compile 'com.jakewharton:butterknife:6.1.0'
    compile 'com.jakewharton.timber:timber:2.5.1'
    compile 'com.braintreepayments:encryption:2.0.0'
    compile 'com.newrelic.agent.android:android-agent:5.3.2'
    compile 'com.instabug.library:instabugsupport:1.7.1'
    compile 'net.hockeyapp.android:HockeySDK:3.0.2'
    provided 'com.squareup.dagger:dagger-compiler:1.2.2'
    compile 'com.rengwuxian.materialedittext:library:2.1.4'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.mixpanel.android:mixpanel-android:4.6.2'
    compile 'com.roomorama:caldroid:2.2.0'
    compile 'com.squareup.phrase:phrase:1.1.0'
    compile 'com.zendesk:sdk:1.5.0.1'
    compile 'com.flipboard:bottomsheet-core:1.4.3'
    compile 'com.kahuna.sdk:kahuna:2.3.1'
    compile 'io.branch.sdk.android:library:1.+''
}
How to solve:

Versions of play-services libs should be equal, for example:

DO

compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'

DONT

compile 'com.google.android.gms:play-services-maps:7.8.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'

###

When selectively compile Google Play service APIs on 8.4.0, I’ve also encountered problems (8.3.0 -> 8.4.0).

Error:

Could not find method com.google.android.gms.common.internal.zzx.zzy

Before upgrade:

compile 'com.google.android.gms:play-services-maps:8.3.0'

After upgrade (doesn’t work):

compile 'com.google.android.gms:play-services-maps:8.4.0'

After upgrade (works fine):

compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'

Conclusion: it seems like some of the play services now have some certain dependencies that you have to explicitly specify, e.g.: maps -> gcm.

###

I was able you solve this. My coworker was able to upgrade without issues. I went to my sdk/extras folders saw mine was pretty different. So I moved my folder copied my coworkers and it worked.

I think that folder and maybe something else in the sdk folder had just gotten into an odd state, clearing the folder and redownloading may work too.

###

I just had this issue but solved it by downgrading the gradle version like so:

Old, troublesome version:

    classpath 'com.android.tools.build:gradle:2.2.0-rc2'

Fixed version:

    classpath 'com.android.tools.build:gradle:2.1.3'

###

I ran into this issue just now. I upgraded from 7.8.0 to 8.4.0 and received the same error that you did. Rebuilding and/or cleaning the project worked for me.

###

I have face same problem and resolve this issue by configuring proguard rules properly.

What I did here under as below:

First I have excluded google classes from obfuscating like this in proguard-rules.pro:

-keep public class com.google.** {*;}

Second I have enabled this minifyEnabled in build.gradle like this:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.e2e.quiz"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:recyclerview-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.github.bumptech.glide:glide:3.6.1'
    compile 'com.squareup.picasso:picasso:2.4.0'
    compile 'com.google.android.gms:play-services-gcm:9.2.1'
    compile 'com.google.android.gms:play-services-analytics:9.2.1'
    compile 'com.google.android.gms:play-services-ads:9.2.1'
    compile project(':ast-dst')
}

###

I think you should include the -base library of the same version. Then it starts working again.

###

I’ve faced the same issue while going through the official tutorial.

Solution was to change

classpath 'com.google.gms:google-services:2.0.0-alpha6'

to

classpath 'com.google.gms:google-services:3.0.0'

I’ve found the correct version number in the sample on the github.

###

Removing and reinstalling Google Services from the SDK manager and deleting the contents of your-project/.gradle/ solved it for me

###


compile 'com.google.android.gms:play-services:+'
compile 'com.google.firebase:firebase-core:+'

What works for me

Leave a Reply

Your email address will not be published. Required fields are marked *