LoginSignup
0
0

「Deprecated imperative apply of Flutter's Gradle plugins」対応した時に遭遇した現象のメモ

Posted at

はじめに

Flutter 3.16からGradleの新しい宣言的な書き方がサポートされ、(確か)Flutter 3.19系からは古い書き方のままだと警告されます。
以下のマイグレーションガイドに応じて対応すればいいのですが、そこで一点ハマったことのメモです。

遭遇したエラー

com.google.firebase.crashlyticsの書き方を宣言的にすると以下のエラーが発生しました。
2.2.0は古いバージョンだったので、当時最新の2.9.9にするとエラーはおさまりました。

* What went wrong: Plugin [id: 'com.google.firebase.crashlytics', version: '2.2.0', apply: false] was not found in any of the following sources: - Gradle Core Plugins (plugin is not in 'org.gradle' namespace) - Included Builds (None of the included builds contain this plugin) - Plugin Repositories (could not resolve plugin artifact 'com.google.firebase.crashlytics:com.google.firebase.crashlytics.gradle.plugin:2.2.0')

具体的には
以下のコードを

android/app/build.gradle
~~~
apply plugin: 'com.google.firebase.crashlytics'
~~~
android/build.gradle
buildscript {
~~~
    dependencies {
            classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0'
~~~

こうしていました

android/app/build.gradle
plugins {
    id "com.google.firebase.crashlytics"
~~~
android/settings.gradle
~~~
plugins {
    id "com.google.firebase.crashlytics" version "2.9.9" apply false

公式のマイグレーションのサンプルとバージョン以外同じです。

原因

Google's Maven Repositoryを見ると原因が分かりました。

新しく指定しているcom.google.firebase.crashlyticsは2.8.1以降しかリポジトリに存在しませんでした。
image.png

これまで指定していたcom.google.firebase:firebase-crashlytics-gradleは2.2.0も存在しました。

image.png

まとめ

Google's Maven Repositoryにはcrashlyticsがcom.google.firebase.crashlyticsとcom.google.firebaseそれぞれにある。
com.google.firebase.crashlyticsの方は2.8.1以降の新しいものしかない。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0