flutter 如何解决异常“Android Gradle插件仅支持KotlinGradle插件版本1.5.20及更高版本”,

yc0p9oo0  于 2022-12-24  发布在  Flutter
关注(0)|答案(2)|浏览(310)

我有一个flutter移动的应用程序。当我运行flutter时,我得到了以下错误。我对Android不是很熟悉。我知道我自己没有使用“sign_in_with_apple”。
我尝试过但没有帮助的事情:

flutter clean
rm pubspec.lock
flutter pub upgrade  
flutter pub upgrade --major-versions

有人能帮忙吗。谢谢

The Android Gradle plugin supports only Kotlin Gradle plugin version 1.5.20 and higher.
The following dependencies do not satisfy the required version:
project ':sign_in_with_apple' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50

以下是android/build.gradle的外观:

buildscript {
    ext.kotlin_version = '1.6.10'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.3.1'
        // START: FlutterFire Configuration
        classpath 'com.google.gms:google-services:4.3.14'
        // END: FlutterFire Configuration
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

下面是我的pubspec.yaml文件的外观:

name: ###
description: ###
version: 1.1.1+18
publish_to: none

environment:
  sdk: '>=2.18.6 <3.0.0'
  flutter: 3.3.8

dependencies:
  android_id: ^0.1.3+1
  badges: ^2.0.3
  cached_network_image: ^3.2.3
  carousel_slider: ^4.2.0
  cloud_firestore: ^4.2.0
  cloud_functions: ^4.0.6
  connectivity_plus: ^3.0.2
  device_info_plus: ^8.0.0
  dotted_border: ^2.0.0+3
  firebase_app_check: ^0.1.1+6
  firebase_auth: ^4.1.5
  firebase_core: ^2.3.0
  firebase_dynamic_links: ^5.0.8
  firebase_messaging: ^14.1.4
  firebase_remote_config: ^3.0.7
  firebase_storage: ^11.0.7
  flash: ^2.0.5
  flutter:
    sdk: flutter
  flutter_dotenv: ^5.0.2
  flutter_facebook_auth: ^4.4.1+1
  flutter_hooks: ^0.18.5+1
  flutter_image_compress: ^1.1.3
  flutter_launcher_icons: ^0.11.0
  flutter_local_notifications: ^12.0.4
  flutter_localizations:
    sdk: flutter
  flutter_slidable: ^2.0.0
  flutter_svg: ^1.1.6
  flutterfire_ui: ^0.4.3+20
  geocoding: ^2.0.5
  geolocator: ^9.0.2
  google_fonts: ^3.0.1
  google_sign_in: ^5.4.2
  hooks_riverpod: ^2.1.1
  http: ^0.13.5
  image_cropper: ^3.0.1
  image_picker: ^0.8.6
  intl: ^0.17.0
  linkable: ^3.0.1
  material_design_icons_flutter: ^6.0.7096
  open_mail_app: ^0.4.5
  package_info_plus: ^3.0.2
  path_provider: ^2.0.11
  pattern_formatter: ^2.0.0
  permission_handler: ^10.2.0
  photo_view: ^0.14.0
  purchases_flutter: ^4.5.0
  rate_my_app: ^1.1.3
  share_plus: ^6.3.0
  shared_preferences: ^2.0.15
  shimmer: ^2.0.0
  store_redirect: ^2.0.1
  timeago: ^3.3.0
  tuple: ^2.0.1
  url_launcher: ^6.1.7
  uuid: ^3.0.7
  webview_flutter: ^3.0.4

dev_dependencies:
  flutter_test:
    sdk: flutter
  mocktail: ^0.3.0
  very_good_analysis: ^3.1.0

flutter:
  uses-material-design: true
  generate: true
  assets:
    - assets/env/
    - assets/email_icons/
    - assets/flags/
    - assets/images/
    - assets/json/
    - assets/social_icons/

更新:我按照@Yashraj的建议,用firebase_ui_firestore替换了过时的flutterfire_ui。在运行“flutter clean”和“flutter run”之后,我得到了以下错误:

FAILURE: Build failed with an exception.

* Where:
Script '/Users/aimnblbol/Developer/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1159

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDevelopmentDebug'.
> Process 'command '/Users/aimnblbol/Developer/flutter/bin/flutter'' finished with non-zero exit value 1

我注意到,我能成功运行“Flutter Run”的唯一方法是删除Android/App/Build,但当我试图为另一台Android设备再次运行该命令时,构建失败。

pnwntuvh

pnwntuvh1#

出现此错误的原因是flutterfire_ui:^0.4.3+20程序包取决于sign_in_with_apple
不建议使用flutterfire_ui
您需要遵循一些步骤来配置flutterfire_ui
阅读自述文件:https://pub.dev/packages/flutterfire_ui

kuarbcqp

kuarbcqp2#

您是否可以尝试更改Kotlin的版本,如图所示,并尝试:

dependencies{
  classpath "org.jetbrains,kotlin:kotlin-gradle-plugin:1.6.10"
}

相关问题