stripe-react-native
stripe-react-native copied to clipboard
Unable to build on android. IOS is working fine.
**React Native Version : 0.68.2 Stripe Version : 0.25
Gradle version used : classpath('com.android.tools.build:gradle:7.0.2')**
- What went wrong: Execution failed for task ':app:mergeDebugResources'.
/Users/mac/.gradle/caches/transforms-3/b252794f6e7766bcaaa62afaf00adf95/transformed/material-1.8.0/res/values/values.xml: Error: Can't determine type for tag '
?attr/shapeAppearanceCornerSmall '
To Reproduce
- npx react-native init
--version 0.68.2 - npm install @stripe/stripe-react-native
- npm run android
Expected behavior The project should work properly but it gives the above error
Screenshots
Additional context
When I use Gradle version "classpath('com.android.tools.build:gradle:7.0.2')". It gives me the above error on debug mode but when I upgrade my gradle version to "classpath('com.android.tools.build:gradle:7.2.2')", it starts working on debug mode but on release mode it gives me an error "Failed to get React Application Context".
The main issue, I think is releated to assets merging because of the file react.gradle in react-native library. Please assist if someone has faced this issue or knows a workaround for it.
Currently I am using Stripe Version 0.19 and it is working fine but there are alot of fixes done after this version so I wanted to upgrade my library.
I'm facing this same issue, it has to do with com.google.android.material:material:1.8.0 not working correctly with gradle tools below 7.2.2, which itself requires react native 0.69+
If you aren't using payment sheets then an easy fix is to force the version to be 1.6.0 like so in your app's dependancy block:
configurations.all {
resolutionStrategy {
force 'com.google.android.material:material:1.6.0'
}
}
7.2.2, which itself requires react native 0.69+
@DhirenAtodaria does RN have that requirement? afaik, if your actual gradle version is 7.3.3 (check your gradle-wrapper.properties
), you should be able to upgrade to classpath("com.android.tools.build:gradle:7.2.2")
in your build.gradle
file
@charliecruzan-stripe yes we're able to upgrade to classpath("com.android.tools.build:gradle:7.2.2") but that doesn't find react application context on release build. I don't know why is that but the issue is with merging assets. It says make sure your app is bundled correctly.
I have also mentioned what happens when I upgrade to classpath("com.android.tools.build:gradle:7.2.2")
7.2.2, which itself requires react native 0.69+
@DhirenAtodaria does RN have that requirement? afaik, if your actual gradle version is 7.3.3 (check your
gradle-wrapper.properties
), you should be able to upgrade toclasspath("com.android.tools.build:gradle:7.2.2")
in yourbuild.gradle
file
Yeah sorry, requirement is the wrong word, I'd say 'bugged' is more suitable 😅, but yeah like the poster above, we can upgradle to gradle tools 7.2.2, the problem occurs when you build a release version of the app, apparently there's some issues with the actual bundling of the js and it ends up causing the 'FATAL EXCEPTION: create_react_context' you can read more here: https://stackoverflow.com/questions/72564710/react-native-crash-release-build-fatal-exception-create-react-context
There were some suggested fixes but I deemed it wasn't worth the effort figuring it out and debugging after every release build for a simple library upgrade so ended up just forcing the material version since I don't use payment sheets regardless.
I wouldn't be able to say how many rn versions are affected, but essentially there will be an implicit requirement now for these gradle tools in order to use the latest version.
@DhirenAtodaria the issue is with some configuration in react.gradle file present in the react-native library itself. I tried upgrading the react native then everything works fine but I cannot upgrade react native version of my app.
Got the same issue in "com.android.tools.build:gradle:7.2.1" , "com.google.android.material:material:1.6.0"
I'm facing this same issue, it has to do with com.google.android.material:material:1.8.0 not working correctly with gradle tools below 7.2.2, which itself requires react native 0.69+
If you aren't using payment sheets then an easy fix is to force the version to be 1.6.0 like so in your app's dependancy block:
configurations.all { resolutionStrategy { force 'com.google.android.material:material:1.6.0' } }
where to add this ? which file ?
I'm facing this same issue, it has to do with com.google.android.material:material:1.8.0 not working correctly with gradle tools below 7.2.2, which itself requires react native 0.69+ If you aren't using payment sheets then an easy fix is to force the version to be 1.6.0 like so in your app's dependancy block:
configurations.all { resolutionStrategy { force 'com.google.android.material:material:1.6.0' } }
where to add this ? which file ?
Hey, sorry for the late reply, but this goes in your build.gradle in your dependencies block
I resolve this issue by using following configuration ,
android/build.gradle
dependencies {
...
classpath("com.android.tools.build:gradle:7.2.2")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.10")
...
}
android/app/build.gradle
dependencies {
...
implementation 'com.google.android.material:material:1.6.0'
...
}
NOTE: distribution url in gradle-wrapper.properties must not be lower than distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
I resolve this issue by using following configuration ,
android/build.gradle
dependencies { ... classpath("com.android.tools.build:gradle:7.2.2") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.10") ... }
android/app/build.gradle
dependencies { ... implementation 'com.google.android.material:material:1.6.0' ... }
NOTE: distribution url in gradle-wrapper.properties must not be lower than
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
This solved my issue Thank you