简体   繁体   中英

Failed to upgrade Fabric Crashlytics to Firebase Crashlytics

I tried to follow the officiall upgrade documentation, but after I changed every related lines in gradle files I got this error:

A problem occurred evaluating project ':app'. Failed to apply plugin [id 'com.google.firebase.crashlytics'] Could not set unknown property 'obfuscatorVersion' for object of type com.google.firebase.crashlytics.buildtools.gradle.CrashlyticsExtension.

These are the Firebase versions:

firebaseCrashlytics = '17.0.1'

firebaseAnalytics = '17.4.3'

Other related dependencies:

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

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

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

If I comment out this line:

apply plugin: 'com.google.firebase.crashlytics'

everything is working fine... I can't upgrade to gradle 4.0.0 because DexGuard doesn't support it.

Ok, I got it. If anybody using DexGuard them must the Crashlytics plugin should be applied before the DexGuard plugin. This piece of magic linked in the release notes...

Use below configuration if your facing build issues using Android studio 4.1

  • Android Gradle Plugin Version 3.6.0
  • Gradle Version 6.5
implementation platform('com.google.firebase:firebase-bom:26.2.0')
implementation 'com.google.firebase:firebase-crashlytics'

classpath 'com.google.gms:google-services:4.3.4'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'```

Looks like gradle version issue.

Use updated gradle version:- classpath "com.android.tools.build.gradle:4.0.0"(latest)

or classpath 'com.android.tools.build.gradle:3.6.3'(old)

and updated gradle-wrapper.properties:- distributionUrl=https://services.gradle.org/distributions/gradle-6.1.1-all.zip(latest)

or distributionUrl=https://services.gradle.org/distributions/gradle-5.6.4-all.zip(old)

FLUTTER DEVELOPMENT :

Just for problem in future with FLUTTER framwork i had the same issue listed here on the question and the problem was in the file build.gradle and it gives me the following issue:

Build file 'C:\Users\MyUserName\AndroidStudioProjects\FlutterX UI\android\app\build.gradle' line: 23

  • What went wrong: A problem occurred evaluating project ':app'.

Failed to apply plugin 'com.google.firebase.crashlytics'. Crashlytics was applied to a project without an Android plugin. Please make sure the Crashlytics plugin is applied after the appropriate Android plugin for your project.

AND i am using in pubspec.yaml those plugins: firebase_crashlytics , firebase_core .

So what caused a porblem for me the was in the file build.gradle and specificly in those line:

apply plugin: 'com.google.firebase.crashlytics'

apply plugin: 'com.google.gms.google-services'

apply plugin: 'com.android.application'

i just rearranged them as following and it worked like a charm:

apply plugin: 'com.android.application'

apply plugin: 'com.google.firebase.crashlytics'

apply plugin: 'com.google.gms.google-services'

I hope it will help someone in the future.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM