square / in-app-payments-react-native-plugin

Apache License 2.0
116 stars 49 forks source link

[Expo 50] Execution failed for task ':react-native-square-in-app-payments:compileDebugJavaWithJavac'. #235

Closed kuldip-simform closed 3 months ago

kuldip-simform commented 3 months ago

Describe the issue

I have upgraded to new expo version 50 and then I started build in eas but I am getting this error. Execution failed for task ':react-native-square-in-app-payments:compileDebugJavaWithJavac'.

To Reproduce

Steps to reproduce the issue.

For example -

  1. Add this module in expo project
  2. run eas build for android devclient

Expected behavior

It should be create build without any error.

Environment (please complete the following information): System: OS: macOS 13.5.1 CPU: (8) arm64 Apple M1 Memory: 65.03 MB / 16.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 21.6.2 path: /opt/homebrew/bin/node Yarn: version: 1.22.18 path: /opt/homebrew/bin/yarn npm: version: 10.2.4 path: /opt/homebrew/bin/npm Watchman: version: 2024.01.22.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.15.2 path: /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms:

Screenshots

Screenshot 2024-04-19 at 3 47 33 PM

Additional context

kuldip-simform commented 3 months ago

I am using Expo 50. I have tried in 2 other projects which use Expo 50. In all the projects build is failing. If I remove this package, then the build is a success.

YoussefHenna commented 3 months ago

This seems to be culprit

node_modules\react-native-square-in-app-payments\android\src\main\java\sqip\react\CardEntryModule.java:304: error: cannot find symbol
    theme.applyStyle(R.style.sqip_Theme_CardEntry, true);
YoussefHenna commented 3 months ago

Possibly duplicate of https://github.com/square/in-app-payments-react-native-plugin/issues/229

kuldip-simform commented 3 months ago

Do you know how to fix this @YoussefHenna

kuldip-simform commented 3 months ago

Thank you @YoussefHenna for your response. I am currently running build. Update here status of that once build is done.

YoussefHenna commented 3 months ago

Commenting the line out with this patch works as suggested in https://github.com/square/in-app-payments-react-native-plugin/issues/229

react-native-square-in-app-payments+1.7.5.patch

diff --git a/node_modules/react-native-square-in-app-payments/android/src/main/java/sqip/react/CardEntryModule.java b/node_modules/react-native-square-in-app-payments/android/src/main/java/sqip/react/CardEntryModule.java
index 9fe2a7e..2c906b0 100644
--- a/node_modules/react-native-square-in-app-payments/android/src/main/java/sqip/react/CardEntryModule.java
+++ b/node_modules/react-native-square-in-app-payments/android/src/main/java/sqip/react/CardEntryModule.java
@@ -301,7 +301,7 @@ class CardEntryModule extends ReactContextBaseJavaModule {
   private long readCardEntryCloseExitAnimationDurationMs() {
     long delayDurationMs = 0;
     Resources.Theme theme = Objects.requireNonNull(getCurrentActivity()).getResources().newTheme();
-    theme.applyStyle(R.style.sqip_Theme_CardEntry, true);
+    // theme.applyStyle(R.style.sqip_Theme_CardEntry, true);
     int[] attrs = { android.R.attr.activityCloseExitAnimation };
     TypedArray typedArray = theme.obtainStyledAttributes(null, attrs, android.R.attr.windowAnimationStyle, 0);
     int resId = typedArray.getResourceId(0, -1);
kuldip-simform commented 3 months ago

Yes, this patch works. @YoussefHenna Thank you. Closing this issue.