DavidIjsud
DavidIjsud

Reputation: 67

i am getting this message: your project requires a newer version of the Kotlin Gradle plugin

Hello when i want to run my app in debug mode using F5 key i am getting this message:

[!] Your project requires a newer version of the Kotlin Gradle plugin. │ │ Find the latest version on https://kotlinlang.org/docs/gradle.html#plugin-and-versions, then │ │ update /Users/adm/Documents/Work/manzanos/android/build.gradle: │ │ ext.kotlin_version = ''

but i do what the exact message says adding but after run the app i get the same message:

here my build.gradle (android/build.gradle)

buildscript {
   ext.kotlin_version = '1.6.10'
   ext {
    compileSdkVersion = 30 // o superior
    targetSdkVersion = 30 // o superior
    appCompatVersion = "1.0.2" // o superior
    playServicesLocationVersion = "17.0.0" // o superior
 }

repositories {
    google()
    jcenter()
}

 dependencies {
     classpath 'com.android.tools.build:gradle:3.5.4'
     classpath 'com.google.gms:google-services:4.3.3'
    }
 }

allprojects {
    repositories {
      google()
      jcenter()
   }
}

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

 task clean(type: Delete) {
     delete rootProject.buildDir
}

and here my build.gradle(inside app)

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

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

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

  def keystoreProperties = new Properties()
  def keystorePropertiesFile = rootProject.file('key.properties')
  if (keystorePropertiesFile.exists()) {
     keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
  }


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

  android {
   //compileSdkVersion rootProject.ext.compileSdkVersion
    compileSdkVersion 30

    lintOptions {
       disable 'InvalidPackage'
    }

     defaultConfig {
       applicationId "xxxxxxx"
     //        applicationId "xxxxxx"
       minSdkVersion 21
       targetSdkVersion 30
       versionCode flutterVersionCode.toInteger()
         versionName flutterVersionName
       testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
       targetSdkVersion rootProject.ext.targetSdkVersion
      //  manifestPlaceholders = [appAuthRedirectScheme: 'pe.manzanaverde.manzanos']
     }

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

    buildTypes {
       release {
          signingConfig signingConfigs.release
          useProguard true
          proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard- 
     rules.pro'
         }
      }
   }

   flutter {
      source '../..'
   }



    dependencies {
       implementation 'com.google.firebase:firebase-analytics:17.5.0'
       testImplementation 'junit:junit:4.12'
       androidTestImplementation 'androidx.test:runner:1.1.1'
       androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
    }

here flutter doctor.

Flutter doctor

Here my pubspec.yaml

enter image description here

by the way i am using java and not kotlin so for that reason i dont understand why the message.

thank you so much your answer.

Upvotes: 0

Views: 7460

Answers (1)

DavidIjsud
DavidIjsud

Reputation: 67

I answer my own question:

What i have done is the following steps:

  • i opened my project in Android Studio and wait till it finish load.
  • then go to File->Project Structure->Project
  • then in Android Gradle Plugin Version change to 3.5.4 and Gradle Version to 6.7
  • then Apply
  • close android studio, close vscode
  • re open vscode and fixed.

Upvotes: -1

Related Questions