Home > Back-end >  How to solve the exception "The Android Gradle plugin supports only Kotlin Gradle plugin versio
How to solve the exception "The Android Gradle plugin supports only Kotlin Gradle plugin versio

Time:12-21

I have a flutter mobile application. When I do flutter run, I get the following error. I am not so familiar with Android. I know that I am not using "sign_in_with_apple" my self.

Things that I tried but did not help:

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

Could someone help. Thanks

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

Here is how the android/build.gradle looks like:

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
}

Here is how my pubspec.yaml file looks like:

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/

UPDATE: I replace the deprecated flutterfire_ui with firebase_ui_firestore as suggested by @Yashraj. After running "flutter clean" and "flutter run", I am getting the following error:

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

I noticed that the only way I can run successful "flutter run" is if I delete android/app/build but when I try to run the command again for another android device. The build fails.

CodePudding user response:

Can you try changing the version of Kotlin as shown and try:

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

CodePudding user response:

You got this error because flutterfire_ui: ^0.4.3 20 package is depends on sign_in_with_apple.

flutterfire_ui is deprecated.

You need to follow some steps to configure flutterfire_ui.

Read Readme file : https://pub.dev/packages/flutterfire_ui

  • Related