Muhammad Arafat
Muhammad Arafat

Reputation: 83

The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.40 and higher

Problem when I run the app-

FAILURE: Build failed with an exception.

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"
    }
}

Upvotes: 2

Views: 5403

Answers (5)

Uzma
Uzma

Reputation: 389

  1. Add the kotlin version number for which the error is specified

buildscript { ext.kotlin_version = '1.6.20'//change based on error

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"
}

}

  1. Clean the project

cd android &&./gradlew clean && cd ../

  1. Build the project

Upvotes: 0

zedArt
zedArt

Reputation: 487

it because you have to do this changes at android folder of google_map_location_picker package

Upvotes: 0

Anandh Krishnan
Anandh Krishnan

Reputation: 5984

Try this

   buildscript {
    ext.kotlin_version = '1.6.10' //-> add this
    repositories {
        google()
        mavenCentral()
    }

dependencies {
  classpath 'com.android.tools.build:gradle:4.1.3'
  classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"//->add this

}

Upvotes: 0

Munsif Ali
Munsif Ali

Reputation: 5802

change

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

To This

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

Upvotes: 0

Kaushik Chandru
Kaushik Chandru

Reputation: 17762

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"
    }
}

Upvotes: 1

Related Questions