Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15 #32

Closed
wilsontwm opened this issue Aug 20, 2022 · 4 comments

Comments

@wilsontwm
Copy link

Hi, I got error on invalid Kotlin version when running react-native run-android

React Native version: 0.69.3

e: /Users/wilson/work/carlink/CarlinkApp/node_modules/@baronha/react-native-photo-editor/android/src/main/java/com/reactnativephotoeditor/activity/PhotoEditorActivity.kt: (105, 5): Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15.

@sewonist
Copy link

I have same issue. It must be origin photo library build with old Kotlin version. I try to some other react version though I cannot success build it.

@waaplog
Copy link

waaplog commented Aug 29, 2022

Hi,
Please go to the library folder on android studio and change the kotlin version to 1.6.0
gradle.properties file
PhotoEditor_kotlinVersion=1.6.0
Good luck.

@sewonist
Copy link

Wow!! It work for me. Thanks a lot @waaplog

I should change some code like below.

Edit node_modules/@baronha/react-native-photo-editor/android/gradle.properties

  • PhotoEditor_kotlinVersion=1.6.0

Edit node_modules/@baronha/react-native-photo-editor/android/src/main/java/com/reactnativephotoeditor/PhotoEditorModule.kt

private val mActivityEventListener: ActivityEventListener = object : BaseActivityEventListener() {
    override fun onActivityResult(activity: Activity, requestCode: Int, resultCode: Int, intent: Intent?) {
      if (requestCode == EDIT_SUCCESSFUL && intent != null) {
        when (resultCode) {
          ResponseCode.RESULT_OK -> {
            val path = intent.getStringExtra("path")
            promise?.resolve("file://$path")
          }
          ResponseCode.RESULT_CANCELED -> {
            promise?.reject("USER_CANCELLED", "User has cancelled", null)
          }
          ResponseCode.LOAD_IMAGE_FAILED -> {
            val path = intent.getStringExtra("path")
            promise?.reject("LOAD_IMAGE_FAILED", "Load image failed: $path", null)
          }

        }
      }
    }
  }

Edit node_modules/@baronha/react-native-photo-editor/android/src/main/AndroidManifest.xml

  <application
    android:allowBackup="true"
    tools:replace="android:allowBackup"
    android:requestLegacyExternalStorage="true"
    >

@wilsontwm
Copy link
Author

Yup, it works. Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants