0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

FlutterでFirebaseへ接続したときのエラー対処メモ

Last updated at Posted at 2022-01-30

FlutterをFirebaseへ接続したときにエラーで苦労したのでメモを残す。

作業環境

Win10 home
Flutter 2.8.1
Dart 2.15.1
VSCode 1.63.2

flutter runしたらエラーが出た

Error:uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library

SDKのバージョンが19以上にのみ対応とのこと。
エラー文で検索かけてみたらbuild.gradleminSdkVersion 16って書いてある箇所を19に変更しろとのことだが、残念ながら自分のbuild.gradleには16ではなくflutter.minSdkVersionと書いてあった。
これで正しいのか不安ではあったが、flutter.minSdkVersion19へ変更してみる。

android/app/build.gradle【変更前】
minSdkVersion flutter.minSdkVersion
android/app/build.gradle【変更後】
minSdkVersion 19

再度flutter runしたが、またエラーが出た

赤文字のエラーの後に白文字で下記の文が出た。

[!] Your project requires a newer version of the Kotlin Gradle plugin.
Find the latest version on https://kotlinlang.org/docs/gradle.html#plugin-and-versions, then update
ext.kotlin_version = '<latest-version>'

Kotlinのヴァージョンを新しくしろとのこと
今回もエラー文で検索するとext.kotlin_versionを書き換える必要があるらしい。
先程のbuild.gradleより1階層上のbuild.gradleにext.kotlin_versionの記載があったので、最新のKotlinヴァージョン1.6.10へ書き換えてみる。

注意
先程のminSdkVersionのときと違う build.gradle なので気をつけて!

android/build.gradle【変更前】
ext.kotlin_version = '1.3.50'
android/build.gradle【変更後】
ext.kotlin_version = '1.6.10'

再度flutter runしたらビルド成功した

これで正解なの??
この対処で正しいかは疑問だが、とりあえずエラーは出ずにビルドすることができた。
正しい方法がわかる方は教えていただけるとありがたいです。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?