premieroctet / react-native-wallet

A React-Native wrapper for Apple PassKit and Google Wallet API
17 stars 1 forks source link

Android Build #1

Open tomelsner opened 5 months ago

tomelsner commented 5 months ago

I'm using Expo 51 and am trying to do an android build. It fails with the following error:

FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':premieroctet-react-native-wallet:compileDebugKotlin'. > Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (17) and 'compileDebugKotlin' (11).

Any idea how I can address this?

andresmartinezstay commented 2 months ago

@tomelsner Use this patch to change the java version to 17, it compiles fine:

diff --git a/node_modules/@premieroctet/react-native-wallet/android/build.gradle b/node_modules/@premieroctet/react-native-wallet/android/build.gradle
index 8577ad4..43226e0 100644
--- a/node_modules/@premieroctet/react-native-wallet/android/build.gradle
+++ b/node_modules/@premieroctet/react-native-wallet/android/build.gradle
@@ -54,12 +54,12 @@ android {
   compileSdkVersion safeExtGet("compileSdkVersion", 33)

   compileOptions {
-    sourceCompatibility JavaVersion.VERSION_11
-    targetCompatibility JavaVersion.VERSION_11
+    sourceCompatibility JavaVersion.VERSION_17
+    targetCompatibility JavaVersion.VERSION_17
   }

   kotlinOptions {
-    jvmTarget = JavaVersion.VERSION_11.majorVersion
+    jvmTarget = JavaVersion.VERSION_17.majorVersion
   }

   namespace "com.premieroctet.wallet"
andresmartinezstay commented 2 months ago

Also there is a bug in the implementation when adding a pass:

diff --git a/node_modules/@premieroctet/react-native-wallet/android/src/main/java/com/premieroctet/wallet/RNWalletModule.kt b/node_modules/@premieroctet/react-native-wallet/android/src/main/java/com/premieroctet/wallet/RNWalletModule.kt
index d6e8c3f..e293fb4 100644
--- a/node_modules/@premieroctet/react-native-wallet/android/src/main/java/com/premieroctet/wallet/RNWalletModule.kt
+++ b/node_modules/@premieroctet/react-native-wallet/android/src/main/java/com/premieroctet/wallet/RNWalletModule.kt
@@ -46,7 +46,7 @@ class RNWalletModule : Module() {
         promise.reject(CodedException("Current activity not found"))
         return@AsyncFunction
       }
-      walletClient.savePasses(jwt, appContext.currentActivity!!, addToGoogleWalletRequestCode)
+      walletClient.savePassesJwt(jwt, appContext.currentActivity!!, addToGoogleWalletRequestCode)
       addPassPromise = promise
     }