4
2

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 1 year has passed since last update.

Flutter ใง Android ใ‚’ใƒ“ใƒซใƒ‰ใ—ใŸๆ™‚ใซ Your project requires a newer version of the Kotlin Gradle plugin. ใจๆœ€ๆ–ฐใฎ Kotlin Gradle plugin ใŒๅฟ…่ฆใ ใจๆ€’ใ‚‰ใ‚ŒใŸ

4
Last updated at Posted at 2024-04-07

ใ“ใ‚Œใชใซ

Flutter ใง Android ใ‚’ใƒ“ใƒซใƒ‰ใ—ใŸๆ™‚ใซใ€ Your project requires a newer version of the Kotlin Gradle plugin. ใจ่จ€ใ‚ใ‚Œใฆใ€ๆœ€ๆ–ฐใฎ Kotlin Gradle plugin ใŒๅฟ…่ฆใ ใจๆ€’ใ‚‰ใ‚ŒใŸๆ™‚ใฎๅฏพๅ‡ฆๅ†…ๅฎนใฎใพใจใ‚ใ€‚

โ”Œโ”€ Flutter Fix โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ [!] Your project requires a newer version of the Kotlin Gradle plugin.                                                                                 โ”‚
โ”‚ Find the latest version on https://kotlinlang.org/docs/releases.html#release-details, then update ~/android/build.gradle:                              โ”‚
โ”‚ ext.kotlin_version = '<latest-version>'                                                                                                                โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

้ญ้‡ใ—ใŸๆ™‚ใฎ็’ฐๅขƒๆกไปถ

ใ„ใคใ‹ใ‚‰ใฎใ‚ฟใ‚คใƒŸใƒณใ‚ฐใ‹ใ‚ใ‹ใ‚‰ใชใ„ใ‘ใฉใ€ไปฅไธ‹ใฎๆกไปถใฎๆ™‚ใ“ใฎไบ‹่ฑกใซ้ญ้‡ใ€‚

  • Chip: M2
  • macOS: Sonoma 14.4.1
  • Flutter: v3.19.4
  • Dart: v3.3.2
% flutter --version
Flutter 3.19.4 โ€ข channel stable โ€ข https://github.com/flutter/flutter.git
Framework โ€ข revision 68bfaea224 (2 weeks ago) โ€ข 2024-03-20 15:36:31 -0700
Engine โ€ข revision a5c24f538d
Tools โ€ข Dart 3.3.2 โ€ข DevTools 2.31.1

ใ„ใค็™บ็”Ÿใ—ใŸใ‹

firebase_auth ใƒ‘ใƒƒใ‚ฑใƒผใ‚ธใ‚’ไฝฟใฃใฆ Firebase ใงใฎใƒญใ‚ฐใ‚คใƒณ่ช่จผๆฉŸ่ƒฝใ‚’ๅฎŸ่ฃ…ใ—ใฆใƒ“ใƒซใƒ‰ใ—ใŸๆ™‚

ๅŽŸๅ› 

่ฆใ™ใ‚‹ใซ Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. ใŒใƒใ‚คใƒณใƒˆใฎๆจกๆง˜ใ€‚

% flutter run --device-id emulator-5554
Launching lib/main.dart on sdk gphone64 arm64 in debug mode...
Building with Flutter multidex support enabled.

FAILURE: Build failed with an exception.

* Where:
Build file '~/android/app/build.gradle' line: 43

* What went wrong:
A problem occurred evaluating project ':app'.
> Could not find method kotlinOptions() for arguments [build_xxx$_run_closure2$_closure6@xxx] on extension 'android' of type com.android.build.gradle.internal.dsl.BaseAppModuleExtension.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
Running Gradle task 'assembleDebug'...                           1,523ms
Error: Gradle task assembleDebug failed with exit code 1
% flutter run --device-id emulator-5554
Launching lib/main.dart on sdk gphone64 arm64 in debug mode...
Building with Flutter multidex support enabled.
e: ~/.gradle/caches/transforms-3/xxx/transformed/jetified-play-services-measurement-api-21.6.1-api.jar!/META-INF/java.com.google.android.gmscore.integ.client.measurement_api_measurement_api.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
Running Gradle task 'assembleDebug'...                           2,608ms

โ”Œโ”€ Flutter Fix โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ [!] Your project requires a newer version of the Kotlin Gradle plugin.                                                                                 โ”‚
โ”‚ Find the latest version on https://kotlinlang.org/docs/releases.html#release-details, then update ~/android/build.gradle:                              โ”‚
โ”‚ ext.kotlin_version = '<latest-version>'                                                                                                                โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
Error: Gradle task assembleDebug failed with exit code 1

ไฟฎๆญฃๆ–นๆณ•

ใ‚จใƒฉใƒผใฎๆŒ‡็คบ้€šใ‚Šใ€Kotlin ใฎใƒใƒผใ‚ธใƒงใƒณใ‚’ 1.7.10 ใ‹ใ‚‰ 1.9.0 ใซๅค‰ๆ›ดใ€‚๏ผˆใ‚จใƒฉใƒผใงใฏ 1.7.1 ใฃใฆ่จ€ใฃใฆใŸใ‘ใฉใƒ˜ใƒผใ‚ญใƒ˜ใƒผใ‚ญ๏ผ‰

Before | ไฟฎๆญฃๅ‰

plugins {
    id "dev.flutter.flutter-plugin-loader" version "1.0.0"
    id "com.android.application" version "7.3.0" apply false
    id "org.jetbrains.kotlin.android" version "1.7.10" apply false

    // โ†“ Firebase ่ช่จผใ‚’ไฝฟใ†ใŸใ‚ใซ่ฟฝๅŠ ใ—ใŸใ‚‚ใฎ
    id 'com.google.gms.google-services' version '4.4.1' apply false
}

After | ไฟฎๆญฃๅพŒ

plugins {
    id "dev.flutter.flutter-plugin-loader" version "1.0.0"
    id "com.android.application" version "7.3.0" apply false
    id "org.jetbrains.kotlin.android" version "1.9.0" apply false

    // โ†“ Firebase ่ช่จผใ‚’ไฝฟใ†ใŸใ‚ใซ่ฟฝๅŠ ใ—ใŸใ‚‚ใฎ
    id 'com.google.gms.google-services' version '4.4.1' apply false
}

ใ‚จใƒฉใƒผ่งฃๆถˆใ—ใŸ๏ผ

ใ‚ˆใ‹ใฃใŸใ‚ˆใ‹ใฃใŸ

% flutter run --device-id emulator-5554
Launching lib/main.dart on sdk gphone64 arm64 in debug mode...
Building with Flutter multidex support enabled.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Running Gradle task 'assembleDebug'...                             50.7s
โœ“  Built build/app/outputs/flutter-apk/app-debug.apk.
Installing build/app/outputs/flutter-apk/app-debug.apk...           5.7s
Syncing files to device sdk gphone64 arm64...                    2,007ms

Flutter run key commands.
r Hot reload. ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

A Dart VM Service on sdk gphone64 arm64 is available at: http://xxx
The Flutter DevTools debugger and profiler on sdk gphone64 arm64 is available at: http://xxx?uri=http://xxx
4
2
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
4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?