dooboolab-community / react-native-iap

In App Purchase module for React Native!
https://react-native-iap.dooboolab.com
MIT License
2.81k stars 641 forks source link

Task :react-native-iap:compilePlayDebugKotlin FAILED #2520

Open MuhammadRafeh opened 1 year ago

MuhammadRafeh commented 1 year ago

Please use the Discussion board if you want to get some help. Please use issues to report bugs.

Description

Expected Behavior

Screenshots

**Envir

Screenshot 2023-08-20 at 8 47 32 PM

onment:**

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Press '...'
  3. Error '...' is shown

[Optional] Additional Context

ahmedrowaihi commented 1 year ago

walikom slam brother, I was having this issue a few minutes ago, I traced the last update of this library and I found out that the Kotlin version has changed due to the release of Google Play Billing Library 5.2 increase here gradle.properties#L9 on last version 12.10.7

Apply this patch to your project use patch-package

steps:

  1. create folder named patches on the root of your RN project
  2. under patches folder create a file react-native-iap+12.10.7.patch and pase code below
  3. run command npx patch-package
diff --git a/node_modules/react-native-iap/android/gradle.properties b/node_modules/react-native-iap/android/gradle.properties
index e76bb7c..afc8cdd 100644
--- a/node_modules/react-native-iap/android/gradle.properties
+++ b/node_modules/react-native-iap/android/gradle.properties
@@ -6,7 +6,7 @@ RNIap_buildToolsVersion=30.0.2
 RNIap_ndkversion=21.4.7075529
 RNIap_playServicesVersion=18.1.0
 RNIap_amazonSdkVersion=3.0.3
-RNIap_playBillingSdkVersion=5.2.1
+RNIap_playBillingSdkVersion=5.1.0

 android.useAndroidX=true
 android.enableJetifier=true

Then try to build your project :'D

MuhammadRafeh commented 1 year ago

@ahmedrowaihi Brother I simply updated the kotlin version to "1.8.0" in project/build.gradle and it worked :)

MuhammadRafeh commented 1 year ago

ext { buildToolsVersion = "33.0.0" minSdkVersion = 21 compileSdkVersion = 33 targetSdkVersion = 33 // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP. ndkVersion = "23.1.7779620" kotlinVersion = "1.8.0" androidXAnnotation = "1.1.0" androidXBrowser = "1.0.0" }

ahmedrowaihi commented 1 year ago

Nice, my project's React Native version is 0.69, and using expo modules with version 46.. So updating my kotlin version hits everywhere conflicting with others libs :'(