Home > Back-end >  Kotlin Gradle plugin need update
Kotlin Gradle plugin need update

Time:07-17

Hello for every one I have some problems in vscode i need solve this problem [enter image description here][1] [1]: https://i.stack.imgur.com/NVgB5.png

this is real estate app when i run this app i have get this msg i need to solve this problem here is build.gradle file need to upgrade file

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

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

Blockquote

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

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

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 31

    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.real_estate"
        minSdkVersion 16
        targetSdkVersion 31
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    buildTypes {
        release {
           
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

CodePudding user response:

You need to go to the top-level build.gradle file.

Which is located in [flutter-project-dir]/android/build.gradle

NOT in [flutter-project-dir]/android/app/build.gradle

Find the block of code that says:

ext {
    kotlin_version = <version>
}

or

ext.kotlin_version = <version>

And make it the current latest kotlin_version, which is at the current time is kotlin_version = 1.7.0

  • Related