Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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'
like image 200
Vijay Desai Avatar asked Oct 05 '20 02:10

Vijay Desai


4 Answers

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"
like image 188
Martin Zeitler Avatar answered Oct 17 '22 07:10

Martin Zeitler


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

like image 30
Sharafat Shariff Avatar answered Oct 17 '22 07:10

Sharafat Shariff


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'

like image 28
Haider Saleem Avatar answered Oct 17 '22 07:10

Haider Saleem


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.

like image 2
Nachiket Gohil Avatar answered Oct 17 '22 08:10

Nachiket Gohil