30

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'
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Vijay Desai
  • 333
  • 1
  • 3
  • 7

5 Answers5

27

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"
Martin Zeitler
  • 1
  • 19
  • 155
  • 216
23

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

  • 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!! – Gabcvit Oct 13 '20 at 07:50
  • 1
    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](https://stackoverflow.com/a/63795391/2439941). 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. – Martijn Dec 15 '20 at 13:36
  • 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 Jun 17 '21 at 19:08
  • 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. – Ibrahim.H Jul 30 '21 at 15:25
4

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'

Haider Saleem
  • 773
  • 1
  • 9
  • 17
2

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.

Nachiket Gohil
  • 955
  • 11
  • 17
1

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.

Hunter-Orionnoir
  • 2,015
  • 1
  • 18
  • 23