react-native-pager-view icon indicating copy to clipboard operation
react-native-pager-view copied to clipboard

Incompatibility with react-native-iap: Kotlin version issue

Open pierroo opened this issue 4 years ago • 8 comments

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? :/

pierroo avatar Dec 23 '21 11:12 pierroo

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

janroures avatar Jan 10 '22 16:01 janroures

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.+

pierroo avatar Jan 10 '22 16:01 pierroo

I just found a solution by upgrading kotlin version to 1.5.10

janroures avatar Jan 10 '22 16:01 janroures

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

supershik avatar Jan 10 '22 17:01 supershik

try kotlin 1.5.31

janroures avatar Jan 10 '22 17:01 janroures

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>"

witalobenicio avatar May 26 '22 18:05 witalobenicio

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

Pratik-2102 avatar Jul 21 '23 10:07 Pratik-2102

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

  • "react-native-iap": "^12.10.5",
    
  • "react-native": "0.71.8",
    
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

ShinMini avatar Dec 19 '23 04:12 ShinMini