skip to Main Content

I am developing an app using the dart language, flutter framework and firebase as database, and using the vscode as the code editor. I was running the application in the chrome(debug) and it was working completely fine. But when i tried to build an apk file of the application it is giving me the error:

e: C:/Users/asus/.gradle/caches/transforms-3/5201e1a13f9a2d5ba11117fa4f48584e/transformed/jetified-activity-1.7.2/jars/classes.jar!/META-INF/activity_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.

And at last the apk file is build but when i tried to install it in my android device it shows an empty screen.

I tried to solve the problem by referring solutions from the internet. I updated the version of the
Kotlin in the android level file as:
build.gradle file:

build.gradle file

Also i have updated the gradle-wrapper.properties as:

gradle-wrapper.properties

Since the application is running properly in the web(chrome) so there will be no problem in the code still uploading the main.dart file:

main.dart

Error
Error

2

Answers


  1. You can try versions like this:

    //android/build.gradle
    ext.kotlin_version = '1.7.10'
    
    //android/gradle/wrapper/gradle-wrapper.properties
    distributionUrl=https://services.gradle.org/distributions/gradle-7.5-all.zip
    
    Login or Signup to reply.
  2. This happend to me once, try to change kotlin version inside the build.gradle file:

    buildscript {
    ext.kotlin_version = "1.6.0"
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:7.0.0"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
    

    }

    PS: do not forget to do: flutter clean and flutter pub get before you re-build apk.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search