Google Pay: Missing annotations
See original GitHub issueDescribe the bug
Android builds fail because of an annotations error. I am migrating a react-native project to a monorepo managed with nx. It seems like a misconfiguration related to gradle and linting. The project builds after I remove the @stripe/stripe-react-native package
.
This does not occur if I install the package on a new project with the react-native cli.
I have tried tweaking the gradle versions, but continue to run into this. Could someone please provide pointers to resolving this.
> Task :stripe_stripe-react-native:packageDebugResources FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
58 actionable tasks: 2 executed, 56 up-to-date
ERROR:/Users/esfxra/monorepo/apps/test-app/node_modules/@stripe/stripe-react-native/android/src/main/res/layout/googlepay_button_dark.xml: Resource and asset merger: /Users/esfxra/monorepo/apps/test-app/node_modules/@stripe/stripe-react-native/android/src/main/res/layout/googlepay_button_dark.xml is not annotated as @Input
java.lang.IllegalStateException: /Users/esfxra/monorepo/apps/test-app/node_modules/@stripe/stripe-react-native/android/src/main/res/layout/googlepay_button_dark.xml is not annotated as @Input
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':stripe_stripe-react-native:packageDebugResources'.
> /Users/esfxra/monorepo/apps/test-app/node_modules/@stripe/stripe-react-native/android/src/main/res/layout/googlepay_button_dark.xml: Error: is not annotated as @Input
To Reproduce Steps to reproduce the behavior:
- Run
npm install @stripe/stripe-react-native
- Integrate the
<StripeProvider>{...}</StripeProvider>
component - Run
npx nx run wifi-app:run-android
- See error
This is a repo scaffolded with nx where the error can be reproduced [RN 0.69]:
And this is a repo scaffolded by the react-native cli with no errors [RN 0.69]:
Expected behavior N/A
Screenshots N/A
Desktop (please complete the following information): N/A
Smartphone (please complete the following information):
- Device: Pixel 3
- OS: Android
Additional context N/A
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:16
I won’t be able to get to this super soon, but hope to debug it eventually. I’m curious if this only affects stripe-react-native, or is a more widespread issue with
.xml
assetsI have just started investigating, and it seems like the issue is indeed related to Gradle and the .xml files not being inside the root project (but only symlinked there).
As mentioned above, removing the .xml files and their references fixes the build.
Simple Patch