in-app-payments-react-native-plugin icon indicating copy to clipboard operation
in-app-payments-react-native-plugin copied to clipboard

Cannot find Symbol R (Android) on React Native 0.73

Open fobos531 opened this issue 1 year ago • 13 comments

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):

  • Android
  • macOS
  • In-App payments plugin version: 1.7.5

fobos531 avatar Jan 09 '24 15:01 fobos531

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.

FurySwordXD avatar Jan 14 '24 18:01 FurySwordXD

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

amanrajtoppoart007 avatar Jan 25 '24 05:01 amanrajtoppoart007

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/

fobos531 avatar Jan 25 '24 09:01 fobos531

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

Armaxis avatar Feb 20 '24 18:02 Armaxis

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

theahmadzai avatar Mar 05 '24 03:03 theahmadzai

@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!)

JonathanNakhla-Square avatar Mar 13 '24 23:03 JonathanNakhla-Square

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

tannguyen05 avatar Mar 26 '24 07:03 tannguyen05

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.

trattles avatar Mar 26 '24 15:03 trattles

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

theahmadzai avatar Mar 26 '24 15:03 theahmadzai

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

trattles avatar Mar 26 '24 19:03 trattles

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

Waiting for an update!

tannguyen05 avatar Mar 27 '24 02:03 tannguyen05

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)

YoussefHenna avatar Apr 22 '24 11:04 YoussefHenna

any update on this issue?

doron2402 avatar May 27 '24 09:05 doron2402