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

Apache License 2.0
118 stars 50 forks source link

Cannot find Symbol R (Android) on React Native 0.73 #229

Open fobos531 opened 9 months ago

fobos531 commented 9 months ago

Describe the issue

It seems like on newest React Native version (0.73.x) there's an issue when compiling the application. This did not occur on React Native 0.72.x.

[RUN_GRADLEW] > Task :react-native-square-in-app-payments:mergeReleaseShaders
[RUN_GRADLEW] > Task :react-native-square-in-app-payments:compileReleaseShaders NO-SOURCE
[RUN_GRADLEW] > Task :react-native-square-in-app-payments:generateReleaseAssets UP-TO-DATE
[RUN_GRADLEW] > Task :react-native-square-in-app-payments:generateReleaseRFile
[RUN_GRADLEW] > Task :react-native-square-in-app-payments:packageReleaseAssets
[RUN_GRADLEW] > Task :react-native-square-in-app-payments:extractReleaseAnnotations
[RUN_GRADLEW] > Task :react-native-square-in-app-payments:compileReleaseJavaWithJavac FAILED
[RUN_GRADLEW] /private/var/folders/9r/dyk4mj9s0_qgmnq197tdmrpr0000gn/T/eas-build-local-nodejs/3fd59a4f-8a3e-4f75-98ac-ab46fa1ec40e/build/client/apps/customer/node_modules/react-native-square-in-app-payments/android/src/main/java/sqip/react/CardEntryModule.java:304: error: cannot find symbol
[RUN_GRADLEW]     theme.applyStyle(R.style.sqip_Theme_CardEntry, true);
[RUN_GRADLEW]                       ^
[RUN_GRADLEW]   symbol:   variable style
[RUN_GRADLEW]   location: class R
[RUN_GRADLEW] Note: /private/var/folders/9r/dyk4mj9s0_qgmnq197tdmrpr0000gn/T/eas-build-local-nodejs/3fd59a4f-8a3e-4f75-98ac-ab46fa1ec40e/build/client/apps/customer/node_modules/react-native-square-in-app-payments/android/src/main/java/sqip/react/GooglePayModule.java uses or overrides a deprecated API.
[RUN_GRADLEW] Note: Recompile with -Xlint:deprecation for details.
[RUN_GRADLEW] 1 error
[RUN_GRADLEW] > Task :react-native-safe-area-context:compileReleaseKotlin
[RUN_GRADLEW] w: file:///private/var/folders/9r/dyk4mj9s0_qgmnq197tdmrpr0000gn/T/eas-build-local-nodejs/3fd59a4f-8a3e-4f75-98ac-ab46fa1ec40e/build/client/apps/customer/no

To Reproduce

Initialize an empty react-native 0.73 project. Add and configure the square in app payments SDK. Compile android app.

Expected behavior

The app should compile successfully.

Environment (please complete the following information):

FurySwordXD commented 8 months ago

Same issue was working fine in React Native 0.72.x, errors out in 0.73.

As a temporary work around, I've simply commented out the line // theme.applyStyle(R.style.sqip_Theme_CardEntry, true); and made it patch.

amanrajtoppoart007 commented 8 months ago

Any news when this will be fixed , getting the same issue with react native 0.73

fobos531 commented 8 months ago

Any news when this will be fixed , getting the same issue with react native 0.73

@amanrajtoppoart007 In the meantime, you can use the above suggested patch, however, for a more permanent solution, I think something like this can be used: https://github.com/stripe/stripe-react-native/pull/1579/

Armaxis commented 7 months ago

Do you have a Theme defined in your app like this?

    <style name="sqip.Theme.CardEntry" parent="AppTheme">
        <item name="buttonStyle">@style/CardEntryButton</item>
        <item name="android:windowBackground">@color/colorCardEntryBackground</item>
        <item name="android:textColorHint">@color/alto</item>
    </style>

If you don't want any customization, try an empty definition:

<style name="sqip.Theme.CardEntry" parent="Theme.AppCompat" />
theahmadzai commented 7 months ago

Do you have a Theme defined in your app like this?

    <style name="sqip.Theme.CardEntry" parent="AppTheme">
        <item name="buttonStyle">@style/CardEntryButton</item>
        <item name="android:windowBackground">@color/colorCardEntryBackground</item>
        <item name="android:textColorHint">@color/alto</item>
    </style>

If you don't want any customization, try an empty definition:

<style name="sqip.Theme.CardEntry" parent="Theme.AppCompat" />

Did not work for me:

image
JonathanNakhla-Square commented 6 months ago

@theahmadzai can you try adding sqip.react. to the line theme.applyStyle(R.style.sqip_Theme_CardEntry, true); as such:

theme.applyStyle(sqip.react.R.style.sqip_Theme_CardEntry, true);

Trying to temporarily unblock you until we spin up a new update! (And thx @fobos531 for the suggestion!)

tannguyen05 commented 6 months ago

@JonathanNakhla-Square i tried adding sqip.react. but still error

image
trattles commented 6 months ago

Also tried the sqip.react fix to no avail.

For what it's worth -- I just commented that theme.applyStyle line out completely -- my android app builds and the card entry modal appears to still be working normally in my testing.

theahmadzai commented 6 months ago

I think it's a big issue, a main blocker specially for us after upgrade we're unable to take payments but no response from square or timeline

trattles commented 6 months ago

@theahmadzai have you tried commenting out that line?

It's in android/src/main/java/sqip/react/CardEntryModule.java

comment out theme.applyStyle(R.style.sqip_Theme_CardEntry, true); around line 304.

That worked fine for me, and the payments modal seems to be working fine.

IIUC it's just trying to grab a few animation style props for closing the modal, and the default android theme falls back just fine.

tannguyen05 commented 6 months ago

I want to customize the payment entry form, so the theme.applyStyle line is needed

Waiting for an update!

YoussefHenna commented 5 months ago

I'm seeing this warning

Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported

I'm guessing this is what is causing the underlying issue and the namespace needs to be migrated to the build.gradle (See https://stackoverflow.com/a/74086678/8805150)

doron2402 commented 4 months ago

any update on this issue?