Vijay Desai
Vijay Desai

Reputation: 333

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

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'

Upvotes: 30

Views: 25409

Answers (5)

Martin Zeitler
Martin Zeitler

Reputation: 76639

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"

Upvotes: 27

Nachiket Gohil
Nachiket Gohil

Reputation: 1213

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.

Upvotes: 2

Hunter-Orionnoir
Hunter-Orionnoir

Reputation: 2073

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.

Upvotes: 1

Sharafat Shariff
Sharafat Shariff

Reputation: 261

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

Upvotes: 23

Haider Saleem
Haider Saleem

Reputation: 773

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'

Upvotes: 4

Related Questions