Home > Back-end >  The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.40 and higher
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.40 and higher

Time:08-09

Problem when I run the app-

FAILURE: Build failed with an exception.

  • What went wrong: The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.40 and higher. The following dependencies do not satisfy the required version: project ':google_map_location_picker' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.31

My project environment--

version: 1.0.0 1

environment:
  sdk: ">=2.11.0 <3.0.0"
module:
  androidX: true
dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter

System Installed Flutter SDK--

[√] Flutter Channel stable, 3.0.5,

Code blew-

android/app- build.gradle

android {
    compileSdkVersion 31

    sourceSets {
        main.java.srcDirs  = 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "indil.customer"
        minSdkVersion 21
        targetSdkVersion 31
        multiDexEnabled true
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
//            signingConfig signingConfigs.debug
            signingConfig signingConfigs.release
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.google.firebase:firebase-messaging:20.1.7'
    implementation 'androidx.annotation:annotation:1.1.0'
    implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}

android - build.gradle

buildscript {
    ext.kotlin_version = '1.3.40'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.google.gms:google-services:4.3.10'
        classpath 'com.android.tools.build:gradle:7.0.3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

CodePudding user response:

Change the kotlin version in build.gradle

android - build.gradle

buildscript {
    ext.kotlin_version = '1.3.31'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.google.gms:google-services:4.3.10'
        classpath 'com.android.tools.build:gradle:7.0.3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

CodePudding user response:

change

"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

To This

org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version

  • Related