iaphub / react-native-iaphub

The easiest way to implement IAP (In-app purchase) in your React Native app.
https://www.iaphub.com/
MIT License
317 stars 21 forks source link

RNIaphubModule.kt: (22, 4): Class 'kotlin.Suppress' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15. #127

Closed deggertsen closed 1 year ago

deggertsen commented 1 year ago

Is it necessary to downgrade Kotlin at this time to 1.1.15? I'm getting errors when building on a new Expo app build with IAPHUB. I've attached a file with all the errors. Let me know what the best was to resolve this issue would be. Thanks!

iaphub_build_errors.txt

flogy commented 1 year ago

Getting the same error with react-native: 0.70.2

deggertsen commented 1 year ago

I'm using "expo": "46.0.15" "react": "18.0.0" "react-native": "0.69.4"

flogy commented 1 year ago

Was able to solve it by adding

kotlinVersion = "1.6.0"

to my android/build.gradle as ext variable:

buildscript {
    ext {
        buildToolsVersion = "31.0.0"
        minSdkVersion = 21
        compileSdkVersion = 31
        targetSdkVersion = 31

        if (System.properties['os.arch'] == "aarch64") {
            // For M1 Users we need to use the NDK 24 which added support for aarch64
            ndkVersion = "24.0.8215888"
        } else {
            // Otherwise we default to the side-by-side NDK version from AGP.
            ndkVersion = "21.4.7075529"
        }

        kotlinVersion = "1.6.0"
    }

Would still be nice to set this as default in this library though. Also it seems that most libraries call this variable kotlin_version - maybe this could be aligned as well?

deggertsen commented 1 year ago

That resolved it for me as well. Agree that it would be great if IAPHUB could support the most recent kotlin version.

iaphub commented 1 year ago

Thanks for the feedback, we'll fix this issue on the next release. @flogy is right on the fix, the reason is simply that the wrong version of kotlin is used. I'm closing the issue but I'll comment on the thread when we push a fix.

iaphub commented 1 year ago

The issue should be fixed in the latest update (8.1.4).