Lyokone / flutterlocation

A Flutter plugin to easily handle realtime location in iOS and Android. Provides settings for optimizing performance or battery.
MIT License
1.07k stars 780 forks source link

The Android Gradle plugin supports only Kotlin Gradle plugin version 1.5.20 and higher. #941

Open Abhiabhi07 opened 1 month ago

Abhiabhi07 commented 1 month ago

Hi, as title describes to updrage my kotlin version iam not getting in which file to upgrade my kotlin version. tried sevral methods by updating version but didnt work any so please say me where i need to increase my org.jetbrains.kotlin:kotlin-gradle-plugin version. below are my build.gradle file and app/build.gradle file from vscode, please go through it and say the what need to be done.

=============== build.gradle

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

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

tasks.register("clean", Delete) { delete rootProject.buildDir }

=================

app/build.gradle file

plugins { id "com.android.application" id "kotlin-android" id "dev.flutter.flutter-gradle-plugin" }

def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { localPropertiesFile.withReader('UTF-8') { reader -> localProperties.load(reader) } }

def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' }

def flutterVersionName = localProperties.getProperty('flutter.versionName') if (flutterVersionName == null) { flutterVersionName = '1.0' }

android { namespace "com.example.ambuvians" compileSdk 34 ndkVersion flutter.ndkVersion

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
    jvmTarget = '1.8'
}

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

defaultConfig {
    // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
    applicationId "com.example.ambuvians"
    // You can update the following values to match your application needs.
    // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
    minSdkVersion 21
    targetSdkVersion 34
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
}

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

}

flutter { source '../..' }

dependencies { // classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" implementation 'com.mapbox.maps:android:11.2.2' } please what would be the issue please let me know

bartekpacia commented 1 month ago

To make sure your .gradle files are in the appropriate format, you can refer to:

priyankabambharoliya-official commented 1 month ago

having the same issue in location: ^6.0.1 I have added the below code to my build.gradle file

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

   dependencies {
       classpath 'com.android.tools.build:gradle:8.3.1'
       classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
   }
}

and update the distribution URL to this distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip

still getting the same error to update the kotlin version

hitarthparmar0412 commented 1 month ago

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

dependencies {
    classpath 'com.android.tools.build:gradle:8.1.0'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

}

}`

I got an error

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 ': location' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.20