-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Google Pay: Missing annotations #1078
Comments
hm, that xml file is basically the same as |
Hi, I have the same problem since I tried to upgrade to react native 0.69. I also use nx but Gradle 7. |
Interesting- our example app is RN .69 as well, and Gradle 7. I'm not familiar with nx, is there a way to duplicate your environment but without nx and see if the problem persists? |
The 8.0 warning seems to appear even if you are running 7.x. Still experiencing this error after trying different gradle versions. My current setup (same as default for RN 0.69):
When comparing the rn-cli project with the nx-cli one, I can note a few additions to gradle for the nx project:
Also, I edited the main comment with links to 2 repos:
@charliecruzan-stripe Do you have any advice on how I can attempt to add the annotation that the build process errors out with? Will probably also raise this issue in the nx repo as I still think its something related to tooling that could maybe be disabled / decoupled. |
@esfxra just for your information my project has been created 1 year ago and did not include the additions to gradle you mentioned, and it doesn't work anyway. I'm going to try to extract the react native app from my nx project and see if the problem is fixed. |
We have the same issue with Rushstack mono-repo. Copy @stripe/stripe-react-native directly to project node_modules works in our case. Might be an issue of resolving symlink path. |
Hey @squadnet-app with NX the whole node_modules folder is a symbolic link. I attempted combining it with Yarn and its @m-thenot Sorry to hear that. Yeah I added those libs to the gradle file of the normal RN scaffold and it was still compiling well. Probably related to the symlinks as mentioned, and, at least in the case of NX, to the wrapper that runs the react-native CLI. |
I cloned the library and used it as a symlink in a new react native project, and the problem appears again. So I can confirm that the problem is related to symlinks. All buttons in the layout folder trigger this error. When I remove all the buttons, the build works again. I'm not an Android / Kotlin developer, so I'm not really in a position to suggest a PR to fix this. @charliecruzan-stripe Could you try to debug this issue as we now know how to reproduce it? |
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 |
I 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
|
@charliecruzan-stripe any update ? |
This comment was marked as duplicate.
This comment was marked as duplicate.
is there already any progress or solution? I now ran into the same problem after upgrading to RN 0.70.3 |
Not yet, as I said above, I'm curious if this only affects stripe-react-native, or is a more widespread issue with .xml assets. Maybe someone with the nx setup can let me know |
I have the same issue and change the build version on Android and rollback the stripe version and the issue persist |
I've fixed this issue by using
|
@charliecruzan-stripe I can answer the question (I think). First, we use Gradle 7 (and nx) and see the same issue. Ours do happen on the As for your question. We have a relatively big react-native app and I see many xml files, for the npm org I could be looking at the wrong thing. I made Last, we did set up a barebone react-native app with only the stripe-react-native npm package and no nx. It works. So it's probably smg due to nx. It does feel like nx makes some assumption of how these files should be organized (maybe?) and stripe-react-native would be breaking that assumption. We tried the patch from @retro and it works. |
Thanks @andreacab2 ! that's good to know. If this works with a regular project, but not nx, then it might be useful to file an issue over at that repo? |
On the new version of the library fix the problem with some .xml but appear new errors. The problem is symlinks of the node_modules folder with react native app folder |
Closing this for now since it seems like an issue with |
Seeing this as well in our update to latest stripe-react-native and react-native. We're in a monorepo that uses pnpm to manage dependencies, which also relies on symlinks. This library did work under pnpm before bumping to latest. |
Bumping from which version to 0.23.3? |
@charliecruzan-stripe in our case we're bumping two libraries at once:
Everything had worked fine with RN 0.64.4 + stripe 0.22.1. I'm not sure which of the two updates is the culprit here but I'd guess it's likely an issue with gradle or one of its plugins when it tries to compile an app with symlinked xml assets? Currently heads down on the migration so don't have the time to make a minimal repro, for the moment we're just patching and moving on. But worth noting this is our only dependency that has this problem. It's possible this is our only dependency with XML assets but would have to run an audit to make sure. |
Yeah that's my main question here, thanks so much for the info, and sorry to leave you with just the workaround. If I can find some extra time to try and test another library with xml assets with |
Here's the result of
so it's only react-native-prompt-android that has any other xml assets in our repo. It references the edit_text layout here. I don't know enough about android assets to really say much else. I'm not sure why this one wouldn't cause an issue but the library is ancient enough that I wouldn't be surprised if its build process is different. Sidenote, it looks like this specific error message comes from the official android gradle plugin. Seems plausible that that's where the bug ultimately lies especially given how much of the logic there deals with determining whether a file is in a specific folder path, could see all sorts of edge-cases there when dealing with symlinks. |
I'm getting this error in an expo project I've just updated to expo@48 from 44. Lots of big package updates including stripe/stripe-react-native@0.2.3 to 0.23.3. Using eas build which appears to use Gradle 7.5.1 Getting error: Any advice would be appreciated, because I have so little control over the build process because EAS handles everything I'm not sure what I can even try. |
I resolved this issue by stopping using expo-yarn-workspaces and moving to the new expo way using metro config. So yes again it seems related to symlinks like the other examples here. |
Can this be reopened, only package that has this issue |
This seems like an issue with symlinks & nx, not with this library. Have you tried the workaround shared here: nrwl/nx#14414 Maybe something about nx is skipping adding each native android module's androidSourceDir? |
Just FYI I wasn't using NX, well I guess unless expo uses it under the hood, but I'm fairly sure it doesn't as you have to make changes to plug them together. I can't see how it's an nx problem. Seems like just symlinks and anything that relies on them might cause this issue. I mostly agree that it's probably not the fault of the stripe project, but it might be possible that a solution in the project is still possible. |
@retro, Your patch worked to avoid the annotations error but I'm now seeing another error when trying to build a release flavor after utilizing the patch. Since it's related, should I open a new issue or paste in this discussion @charliecruzan-stripe? |
@airowe The two issues seem unrelated; I have this patch & build flavors working flawlessly together... |
Team any idea? Nx React Native Project
|
I approached this issue with this patch;
package com.reactnativestripesdk
import android.view.LayoutInflater
import android.widget.FrameLayout
import com.facebook.react.uimanager.ThemedReactContext
class GooglePayButtonView(private val context: ThemedReactContext) : FrameLayout(context) {
private var buttonType: String? = null
fun initialize() {
// val type =
// when (buttonType) {
// "pay" -> R.layout.pay_with_googlepay_button
// "standard" -> R.layout.googlepay_button
// else -> R.layout.googlepay_button
// }
// val button = LayoutInflater.from(context).inflate(
// type, null
// )
// addView(button)
}
fun setType(type: String) {
buttonType = type
}
}
// implementation 'com.google.android.material:material:1.3.0'
// implementation 'com.stripe:stripe-android:20.12.+'
#!/bin/bash
ORIGINAL_DIR="node_modules/@stripe/stripe-react-native/android/src/main"
FIXED_DIR="patched_node_modules/@stripe/stripe-react-native/android/src/main"
# Remove the layout directory
rm -rf "$ORIGINAL_DIR/res/layout"
# Replace the file
cp "$FIXED_DIR/java/com/reactnativestripesdk/GooglePayButtonView.kt" "$ORIGINAL_DIR/java/com/reactnativestripesdk/GooglePayButtonView.kt"
echo "Successfully patched node_modules!"
package com.reactnativestripesdk
import android.view.LayoutInflater
import android.widget.FrameLayout
import com.facebook.react.uimanager.ThemedReactContext
class GooglePayButtonView(private val context: ThemedReactContext) : FrameLayout(context) {
private var buttonType: String? = null
fun initialize() {
// val type =
// when (buttonType) {
// "pay" -> R.layout.pay_with_googlepay_button
// "standard" -> R.layout.googlepay_button
// else -> R.layout.googlepay_button
// }
// val button = LayoutInflater.from(context).inflate(
// type, null
// )
// addView(button)
}
fun setType(type: String) {
buttonType = type
}
}
"scripts": {
...
"postinstall": "./patch.sh"
}, That's it now until the Stripe team fixes this issue, we can survive. |
@aslamanver please note that the |
That patch does not work in our case |
Are there any updates to this? This library is the only one with this error |
Hi @r3dm1ke , not yet, as I haven't had time to investigate this |
Any progress here, still an issue with |
I used this patch on my project which is a mono repo by Nx, It solved the Stripe issue but causes another issue for 'react-native-gesture-handler'
I followed the react-native-gesture-handler approach in their documentation to resolve this issue too, but did not work! |
Same issue here. Any news about this ? |
Same issue ! |
Hey is there any update on this issue? I'm getting this on my project using RN 0.71.11 and RNStripe 0.35.0. I'm using mono repo with pnpm instead of nx. |
This this #1078 (comment) |
same issue here , nothing yet guys ? |
Can you give the steps for a nx project ? /root-folder
|
Any new about it guys ? |
Hi @retro @andreacab2, how you guys can make it work? I tried the solution but it doesn't work in my case |
Describe 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.
To Reproduce
Steps to reproduce the behavior:
npm install @stripe/stripe-react-native
<StripeProvider>{...}</StripeProvider>
componentnpx nx run wifi-app:run-android
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):
Additional context
N/A
The text was updated successfully, but these errors were encountered: