The Android Gradle plugin supports only Crashlytic

2020-06-30 08:57发布

Evironment: Android Studio 3.2

I got a error

The Android Gradle plugin supports only Crashlytics Gradle plugin version 1.25.4 and higher. Project '***' is using version 1.25.1.

Any idea how to solve? Thank you.

标签: android
3条回答
狗以群分
2楼-- · 2020-06-30 09:27

For those of you running into this issue while trying to use the firebase_crashlytics plugin for Flutter, be sure you only follow the instructions for the plugin itself on the pub.dev page there. Do not follow the instructions on the Firebase site. Doing both will create conflicts.

You may still have to update the version number for the io.fabric.tools:gradle classpath in your android/build.gradle file to the version the error log is asking for.

Edit: For those looking for the latest fabric version, you can find it here: https://s3.amazonaws.com/fabric-artifacts/public/io/fabric/tools/gradle/maven-metadata.xml

查看更多
来,给爷笑一个
3楼-- · 2020-06-30 09:39

This exact error message can be encountered another way: outdated version of react-native-firebase. Zapl's solution is more likely necessary, but you may simply need to update your package.json.

In my case, a git merge had brought in all the latest latest firebase SDK for Android in my /android directory, but my package.json was left referring to an older version of react-native-firebase (3.x). I set it to 5.3 and problem solved.

查看更多
劫难
4楼-- · 2020-06-30 09:40

The "Crashlytics Gradle plugin" is found in gradle in the io.fabric.tools:gradle package as mentioned on https://firebase.google.com/docs/crashlytics/get-started#android

You should find that in your projects root build.gradle file. Similar to this

buildscript {
    repositories {
        jcenter()
        google()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'io.fabric.tools:gradle:1.25.1'
        ...
    }
}

allprojects {
    ...

Once you change it to classpath 'io.fabric.tools:gradle:1.25.4' that error should go away.

The versions of a maven dependency can also be found in its maven repository under

https://maven.fabric.io/public/io/fabric/tools/gradle/maven-metadata.xml

That trick should work for all maven repositories once you know the url:

<repo-base-url>/${groupId.replace('.','/')}/${artifactId}/maven-metadata.xml

You can also use a gradle plugin such as https://github.com/ben-manes/gradle-versions-plugin to have it lookup the latest versions in those maven-metadata.xml files for you.

If you simply want the latest you can also define the version with a wildcard, e.g.

classpath 'io.fabric.tools:gradle:1.+' // or even ...:gradle:+'

That would always give you the latest version that starts with 1.. It's rarely done in production since builds become less deterministic when dependency versions change from one moment to the next. But it's good to check whether gradle downloads a newer version.

Furthermore, Android Studio does check versions too, however you don't see the difference between there being no new version and when the check wasn't done yet. But when it did, you'll get an inspection hint and it can be quick fixed.

查看更多
登录 后发表回答