Cannot create a proxy class for abstract class 'GoogleServicesTask'. with 'com.google.gms:google-services:4.3.4'

21,340

Solution 1

Better update this hopelessly outdated Android Gradle Plugin:

classpath "com.android.tools.build:gradle:3.4.2"

To a version, which matches the version of Android Studio ...

classpath "com.android.tools.build:gradle:7.0.2"

Solution 2

I got this issue right after Google release

com.google.gms:google-services:4.3.4

It is working again for me just by reducing the version to 4.3.3.

com.google.gms:google-services:4.3.3

Solution 3

I was having same issue when I updated one of our old project. what worked for me is I downgraded these two dependencies to

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

classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.1'

Solution 4

Change your current gradle version in android/build.gradle like this:

classpath "com.android.tools.build:gradle:4.0.1"

simultaneously, change your gradle-wrapper.properties file and replace last line by this line:

distributionUrl = https\://services.gradle.org/distributions/gradle-6.5-all.zip

then just Delete, gradle-wrapper.jar and run your project. Don't worry gradle-wrapper.jar file will automatically created after running.

Solution 5

This is not a direct answer for the above but all the errors I was searching sent me to this entry often... and our solution was in and around this space. So I hope this helps the very lost souls who end up here. If I formulate an answer when I have the right words I will link to it from here.

The ultimate answer for us was to upgrade to 6.5 gradle and 4.1.1 Android Studio (the most current at the time) BUT when we did this error explains itself WAY better than just a one liner. It actually tells you why it failed and hints at what to do to fix it:

Your flavor names may vary but the error was akin to: Execution failed for task ':app:processArmeabiv7aDebug'.

No matching client found for package name 'com.yourcompany.appname.debug'

We added a suffix to the debug builds so we could have side by side installs. BUT what we failed to do was put an entry into the google-services.json!

Older Android studio/Gradle version combinations simply didn't provide context for the error. I hope this helps someone someday. It may not be the final answer (see upgrade note) but for those limping along with older tools for whatever reason, this answer is to help to the lost one who found this answer.

Share:
21,340
Vijay Desai
Author by

Vijay Desai

Updated on July 09, 2022

Comments

  • Vijay Desai
    Vijay Desai almost 2 years

    Upgraded Fabrics crashlytics to Firebase last night.

    And when I tried to rebuild the app it had many issues, one by one I fixed those but got stuck with this last one:

    Cannot create a proxy class for abstract class 'GoogleServicesTask'

    app/build

    buildscript {
        ext.kotlin_version = '1.3.41'
        repositories {
            google()
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.4.2'
            classpath 'com.google.gms:google-services:4.3.4'
            classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    

    In my app/gradle file I have

    apply plugin: 'com.android.application'
    apply plugin: 'com.google.firebase.crashlytics'
    apply plugin: 'kotlin-android'
    apply plugin: 'kotlin-android-extensions'
    android {
        compileSdkVersion 29
        defaultConfig {
            applicationId "com.xxx.xxxx"
            minSdkVersion 19
            targetSdkVersion 29
            versionCode 23
            versionName "1.1.2"
            testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
            multiDexEnabled true
            vectorDrawables.useSupportLibrary = true
        }
        buildTypes {
            release {
                minifyEnabled true
                shrinkResources true
                firebaseCrashlytics {
                    mappingFileUploadEnabled false
                }
                proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            }
            debug {
                minifyEnabled false
                shrinkResources false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
        compileOptions {
            sourceCompatibility = '1.8'
            targetCompatibility = '1.8'
        }
    }
    dependencies { my all dependencies}
    apply plugin: 'com.google.gms.google-services'
    
  • oaamados
    oaamados over 3 years
  • Vijay Desai
    Vijay Desai over 3 years
    Thanks mate, but downgrading does not do anything except giving more errors. So I upgraded gradle version to 4.0.1
  • Vijay Desai
    Vijay Desai over 3 years
    This worked with so many other errors that I have to fix while upgrading gradle version.
  • Gabcvit
    Gabcvit over 3 years
    I was using "classpath 'com.google.gms:google-services:+'" in my project. Forcing it to be version 4.3.3 fixed the issue as well. Thanks!!
  • Martijn
    Martijn over 3 years
    Although this did resolve the issue, I think it's good practise to use the latest versions. Since we had other Firebase issues, we came across this post. Updating the Gradle version to 5.6.4 in the gradle/wrapper/gradle-wrapper.properties file allowed us to use the most recent com.google.gms:google-services:4.3.4 without issues.
  • Hunter-Orionnoir
    Hunter-Orionnoir about 3 years
    To get cocos2d-x v2 to work this was the solution, to get v3 to work the marten-zeitler answer above did the trick.
  • Hunter-Orionnoir
    Hunter-Orionnoir about 3 years
    To get cocos2d-x v3 to work this was the solution, to get v2 to work the sharafat-shariff answer below did the trick.
  • Ibrahim.H
    Ibrahim.H almost 3 years
    This solved the issue in my case, coz I had to stick to my local gradle v4 so I can't upgrade com.android.tools.build:gradle it requires newer gradle.