callstack / react-native-pager-view

React Native wrapper for the Android ViewPager and iOS UIPageViewController.
MIT License
2.69k stars 413 forks source link

Incompatibility with react-native-iap: Kotlin version issue #494

Open pierroo opened 2 years ago

pierroo commented 2 years ago

When having both this package and react-native-iap, we cannot build for android, we get the following error:

Task :react-native-iap:compilePlayDebugKotlin FAILED
w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath:

=> react-native-pager-view is using kotlin v1.4.0 react-native-iap is using kotlin v1.5.0

I tried changing my android/build.gradle with:

dependencies {
       ...
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0"
    }

But unfortunately the issue remains the same. Anyone managed to fix this? :/

janroures commented 2 years ago

hi, same problem here. did you find any solution?

pierroo commented 2 years ago

I simply brought my react-native-iap version down to ^7.5.3 and the issue went away. :) Seems like they started using kotlin on v8.+

janroures commented 2 years ago

I just found a solution by upgrading kotlin version to 1.5.10

supershik commented 2 years ago

I have faced on the same issue. I tried to use kotlin 1.5.10 but failed still. Please let me know if someone finds a good solution. Thanks

janroures commented 2 years ago

try kotlin 1.5.31

witalobenicio commented 2 years ago

Upgrade your kotlin plugin in react-native:

Go to android/build.gradle and change the following line:

classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:<latest-version-here>"

Pratik-2102 commented 1 year ago

I am still Facing this issue. can anyone help me please

ShinMini commented 9 months ago

I am still Facing this issue. can anyone help me please

I'm afraid it's too late, but here's a patch file that works for me:

I used kotlin v.1.6.0 for android root projct

My react-native project info

diff --git a/node_modules/react-native-iap/android/build.gradle b/node_modules/react-native-iap/android/build.gradle
index e636116..e84eb99 100644
--- a/node_modules/react-native-iap/android/build.gradle
+++ b/node_modules/react-native-iap/android/build.gradle
@@ -9,7 +9,7 @@ buildscript {

   dependencies {
     classpath "com.android.tools.build:gradle:7.4.2"
-    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
+    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0"
   }
 }

diff --git a/node_modules/react-native-iap/android/gradle.properties b/node_modules/react-native-iap/android/gradle.properties
index b8db382..c5483c9 100644
--- a/node_modules/react-native-iap/android/gradle.properties
+++ b/node_modules/react-native-iap/android/gradle.properties
@@ -1,4 +1,4 @@
-RNIap_kotlinVersion=1.7.21
+RNIap_kotlinVersion=1.6.0
 RNIap_minSdkVersion=21
 RNIap_targetSdkVersion=31
 RNIap_compileSdkVersion=31