skip to Main Content

I recently updated my Android Studio and moved my project from Windows to Mac, when I run application on Android device. It works fine but when i run command

flutter build apk --split-per-abi

It gives me errors.

Things which tried and didn’t work

Tried #1

After applying flutter fix:

I changed my project ext.kotlin version from Android/build.gradle to latest (1.9.0)

But it gave me error my Kotlin IDE version in not same as my project, i.e (1.8.0)
I reverted back to (1.8.0)

Currently ext.kotlin in adnroid/build.bradle is 1.8.0
Android Studio IDE kotlin plugin version is 1.8.0

TRIED #2

  • Deleted caches from users/syedAsif/.gradle

  • invalidated caches

  • removed .gradle from android folder

  • Rebuilt app (Not worked and same kotlin error)

TRIED #3

  • Deleted .gradle from users/syedAsif/

  • invalidated caches

  • removed .gradle from android folder

  • Rebuilt app (Not worked and same kotlin error)

Error while building apk
enter image description here

Errors while building apk

enter image description here

Flutter Doctor

enter image description here

Packages I’m using:

firebase_core: ^2.1.1
cloud_firestore: ^4.0.3
firebase_auth: ^4.0.0
firebase_storage: ^11.0.9
get: ^4.6.5
get_storage: ^2.0.3
cached_network_image: ^3.2.2
intl: ^0.18.0
image_picker: ^1.0.1
flutter_bloc: ^8.1.1
smooth_page_indicator: ^1.0.0+2
syncfusion_flutter_gauges: ^22.1.39
flutter_svg: ^2.0.7
table_calendar: ^3.0.8
google_sign_in: ^6.1.4
flutter_facebook_auth: ^5.0.7
sign_in_with_apple: ^5.0.0
the_apple_sign_in: ^1.1.1
permission_handler: ^10.2.0
shimmer: ^3.0.0
firebase_crashlytics: ^3.0.15
# wakelock: ^0.6.2
google_mobile_ads: ^3.0.0
firebase_messaging: ^14.4.0
flutter_slidable: ^3.0.0
in_app_purchase: ^3.1.5
flutter_widget_from_html: ^0.10.3
provider: ^6.0.5
assets_audio_player: ^3.0.6
gdpr_dialog: ^2.1.1
flutter_native_timezone: ^2.0.0
flutter_local_notifications: ^14.1.1
# health: ^7.0.1
url_launcher: ^6.1.11
google_fonts: ^4.0.4
connectivity_plus: ^4.0.1
lottie: ^2.5.0
internet_connection_checker: ^1.0.0+1
skeletons: ^0.0.3

Android/build.gradle

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

    dependencies {
        classpath 'com.android.tools.build:gradle:7.1.3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.15'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.4'
    }
}

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
}

Gradle properties:

org.gradle.jvmargs=-Xmx4608m
android.useAndroidX=true
android.enableJetifier=true

2

Answers


  1. Chosen as BEST ANSWER

    The Main Problem was in SignConfig release. You can see that in the screen shot .It's after "What went wrong" line.

    Cause: I moved my project from windows to mac via github repo and as I added in gitignore file to not move the "upload-keystore" so release config was missing that . Although KOTLIN VERSION problem stays the same.


  2. In your gradle, downgrade to version 1.5.1 as the build error reports.

    The build expect the version 1.5.1 but you are providing the version 1.8.0.

    buildscript {
    ext.kotlin_version = '1.5.1' <--- This One
    repositories {
        google()
        mavenCentral()
    }
    
    dependencies {
        classpath 'com.android.tools.build:gradle:7.1.3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.15'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.4'
    }
    

    }

    If this doesn’t solve your problem please let me know providing updated informations / errors so I can help you! Happy coding

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