auth0 / auth0-flutter

Auth0 SDK for Flutter
https://pub.dev/documentation/auth0_flutter/latest/
Apache License 2.0
57 stars 36 forks source link

Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. #458

Closed Yaman-Kwefati closed 1 month ago

Yaman-Kwefati commented 1 month ago

Checklist

Description

I have used this package in my project. After using it and running it, it runs without any error on IOS but when i run it on Android i get the following: e: Incompatible classes were found in dependencies. Remove them from the classpath or use '-Xskip-metadata-version-check' to suppress errors e: /Users/yamankwefati/.gradle/caches/transforms-3/0b3d1ac2a41df065b440d0de0cc82f99/transformed/jetified-kotlin-stdlib-1.9.0.jar!/META-INF/kotlin-stdlib-jdk7.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. e: /Users/yamankwefati/.gradle/caches/transforms-3/0b3d1ac2a41df065b440d0de0cc82f99/transformed/jetified-kotlin-stdlib-1.9.0.jar!/META-INF/kotlin-stdlib-jdk8.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. e: /Users/yamankwefati/.gradle/caches/transforms-3/0b3d1ac2a41df065b440d0de0cc82f99/transformed/jetified-kotlin-stdlib-1.9.0.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. e: /Users/yamankwefati/.gradle/caches/transforms-3/27829993d30b7d9eed19c6c639d4d12f/transformed/jetified-kotlin-stdlib-common-1.9.0.jar!/META-INF/kotlin-stdlib-common.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1. e: /Users/yamankwefati/.pub-cache/hosted/pub.dev/auth0_flutter-1.7.2/android/src/main/kotlin/com/auth0/auth0_flutter/Auth0FlutterAuthMethodCallHandler.kt: (14, 46): Unresolved reference: find e: /Users/yamankwefati/.pub-cache/hosted/pub.dev/auth0_flutter-1.7.2/android/src/main/kotlin/com/auth0/auth0_flutter/Auth0FlutterAuthMethodCallHandler.kt: (14, 53): Unresolved reference: it e: /Users/yamankwefati/.pub-cache/hosted/pub.dev/auth0_flutter-1.7

and similar errors. I have tried multiple kotlin versions, but none worked.

Reproduction

Just by using it and running on Android devices.

Additional context

No response

auth0_flutter version

1.7.2

Flutter version

3.22.0

Platform

Android

Platform version(s)

No response

Yaman-Kwefati commented 1 month ago

For anyone that might get this error. You dont only update the kotlin versoin like the following in your android/build.gradle: buildscript { ext.kotlin_version = '1.9.24' repositories { google() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:7.3.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } allprojects { repositories { google() mavenCentral() } }

But you also need to update the plugin in android/settings.gradle like : plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version "7.3.0" apply false id "org.jetbrains.kotlin.android" version "1.9.24" apply false // here I updated the version to 1.9.24 latest version as of now }

FlorianREGAZ commented 1 month ago

Worked for me! Thank you!

leen4sal commented 1 month ago

Worked for me! Thank you!

2811267153 commented 1 month ago

感谢您的帮助!谢谢!

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.lock_screen_clock" compileSdk flutter.compileSdkVersion 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.lock_screen_clock"
    // 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 flutter.minSdkVersion
    targetSdkVersion flutter.targetSdkVersion
    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 {} This is my .gradle file. How should I modify it?

eslamrabe123 commented 3 weeks ago

For anyone that might get this error. You dont only update the kotlin versoin like the following in your android/build.gradle: buildscript { ext.kotlin_version = '1.9.24' repositories { google() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:7.3.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } allprojects { repositories { google() mavenCentral() } }

But you also need to update the plugin in android/settings.gradle like : plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version "7.3.0" apply false id "org.jetbrains.kotlin.android" version "1.9.24" apply false // here I updated the version to 1.9.24 latest version as of now }

Worked for me! Thank you!

GeekyROB96 commented 1 week ago

u da saviour !!! :)

FatimaNammour commented 1 day ago

For anyone that might get this error. You dont only update the kotlin versoin like the following in your android/build.gradle: buildscript { ext.kotlin_version = '1.9.24' repositories { google() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:7.3.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } allprojects { repositories { google() mavenCentral() } }

But you also need to update the plugin in android/settings.gradle like : plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version "7.3.0" apply false id "org.jetbrains.kotlin.android" version "1.9.24" apply false // here I updated the version to 1.9.24 latest version as of now }

Worked for me! Thank you!