stripe / stripe-react-native

React Native library for Stripe.
https://stripe.dev/stripe-react-native
MIT License
1.26k stars 263 forks source link

Build error: Could not determine the dependencies of task ':stripe_stripe-react-native:compileDebugJavaWithJavac'. #1595

Closed MatheusSpinosa closed 8 months ago

MatheusSpinosa commented 8 months ago

Describe the bug When I try build my app show this error on my terminal

To Reproduce Steps to reproduce the behavior: npx expo run:android or eas build --profile testing --platform android --local (If I build with the eas server the same happening)

Expected behavior I need generate my apk build

`FAILURE: Build failed with an exception.

BUILD FAILED in 22s 10 actionable tasks: 10 up-to-date Error: my-app/android/gradlew exited with non-zero code: 1`

Apparently is an error with the "com.google.android.gms:play-services-wallet" inside the stripe packages. But I don't have an idea how fix this.

charliecruzan-stripe commented 8 months ago

Constraint path 'Beev:stripe_stripe-react-native:unspecified' --> 'com.google.android.gms:play-services-wallet:{strictly 19.1.0}' because of the following reason: debugRuntimeClasspath uses version 19.1.0

that would be the issue ^ looks like maybe you have another library setting this constraint

KundanOutCode commented 1 month ago

Any idea if this got fixed??

KundanOutCode commented 1 month ago

These are the packages I have used: "dependencies": { "@expo-google-fonts/lato": "^0.2.3", "@expo-google-fonts/playfair-display": "^0.2.3", "@expo/webpack-config": "~19.0.1", "@gorhom/bottom-sheet": "4.6.0", "@gorhom/portal": "^1.0.14", "@invertase/react-native-apple-authentication": "^2.3.0", "@miblanchard/react-native-slider": "^2.3.1", "@notifee/react-native": "^7.8.0", "@react-native-async-storage/async-storage": "~1.21.0", "@react-native-camera-roll/camera-roll": "^5.5.0", "@react-native-community/datetimepicker": "7.6.1", "@react-native-community/image-editor": "^2.3.0", "@react-native-community/netinfo": "11.1.0", "@react-native-firebase/app": "18.7.3", "@react-native-firebase/messaging": "^18.1.0", "@react-native-google-signin/google-signin": "^11.0.0", "@react-native-picker/picker": "^2.4.10", "@react-navigation/bottom-tabs": "^6.5.11", "@react-navigation/native": "~6.1.9", "@react-navigation/native-stack": "^6.9.17", "@react-navigation/stack": "~6.3.20", "@reduxjs/toolkit": "^2.0.1", "@rnmapbox/maps": "^10.0.15", "@sentry/react-native": "5.19.1", "@shopify/flash-list": "^1.6.3", "@stripe/stripe-react-native": "~0.35.1", "@tanstack/react-query": "^5.13.4", "@turf/turf": "^6.5.0", "axios": "^1.6.2", "date-fns": "^2.30.0", "expo": "~50.0.14", "expo-application": "~5.8.3", "expo-constants": "~15.4.5", "expo-device": "~5.9.3", "expo-file-system": "~16.0.8", "expo-font": "~11.10.3", "expo-image-manipulator": "~11.8.0", "expo-linear-gradient": "~12.7.2", "expo-linking": "~6.2.2", "expo-localization": "~14.8.3", "expo-location": "~16.5.5", "expo-media-library": "~15.9.1", "expo-modules-core": "~1.11.12", "expo-splash-screen": "~0.26.4", "expo-status-bar": "~1.11.1", "formik": "^2.4.5", "http-status-codes": "^2.3.0", "i18n-js": "4.3.2", "install-expo-modules": "^0.6.4", "moment": "^2.30.1", "react": "18.2.0", "react-native": "0.73.6", "react-native-actions-sheet": "^0.9.0-alpha.21", "react-native-bootsplash": "5.1.3", "react-native-calendar-strip": "^2.2.6", "react-native-calendars": "^1.1302.0", "react-native-config": "^1.5.1", "react-native-date-picker": "^4.3.4", "react-native-fast-image": "^8.6.3", "react-native-gesture-handler": "^2.14.0", "react-native-gifted-chat": "^2.4.0", "react-native-iap": "^12.12.2", "react-native-image-crop-tools": "^1.6.4", "react-native-maps": "1.10.0", "react-native-modal": "^13.0.1", "react-native-paper": "^5.11.3", "react-native-reanimated": "~3.6.2", "react-native-safe-area-context": "4.8.2", "react-native-screens": "~3.29.0", "react-native-svg-transformer": "^1.3.0", "react-native-uuid": "^2.0.1", "react-native-vector-icons": "^10.0.3", "react-redux": "9.0.3", "redux": "^5.0.0", "redux-persist": "^6.0.0", "socket.io-client": "^4.7.2", "yup": "^1.3.2" },

MatheusSpinosa commented 1 month ago

that would be the issue ^ looks like maybe you have another library setting this constraint

That's make a sense but, how I know with library set this constraint to?

MatheusSpinosa commented 1 month ago

Any idea if this got fixed?? That's a GTP answer, maybe help you. I not fixed this issue because our provider method change in the middle of the project, and this have maybe 8 months

To identify which library in your React Native project is using the same dependency (com.google.android.gms:play-services-wallet:19.1.0), you can follow these steps to inspect the dependencies of your Android libraries:

Steps to identify the library using the conflicting dependency: Check dependencies with gradlew: In Android, you can use the gradlew command to list all project dependencies, which helps to identify which libraries are using this specific dependency. Navigate to the android directory of your project and run the following command in your terminal:

bash Copy code ./gradlew app:dependencies --configuration debugRuntimeClasspath This will list all the dependencies and versions used in the debugRuntimeClasspath. Look for com.google.android.gms:play-services-wallet. This should show which libraries are linked to this dependency. Search the build.gradle file of libraries: Sometimes, you can open the android/build.gradle or android/app/build.gradle file and search for explicitly defined dependencies. Some libraries may force a specific version of play-services-wallet. Use gradlew for a specific library: If you suspect a specific library is causing the problem (like stripe-react-native), you can run the following command specifically for that library: bash Copy code ./gradlew :stripe-react-native:dependencies --configuration debugRuntimeClasspath This will list the dependencies for that specific library, allowing you to see which version of play-services-wallet it's using. Resolve conflicts using resolutionStrategy: In the android/app/build.gradle file, you can automatically resolve version conflicts by setting a resolution strategy. If the conflict is caused by multiple libraries using different versions of the same dependency, you can force a specific version: groovy Copy code configurations.all { resolutionStrategy { force 'com.google.android.gms:play-services-wallet:19.1.0' } } This can solve the conflict, but it's still important to identify which library is enforcing the problematic version. Summary: This type of error typically occurs when two libraries require different versions of the same dependency (in this case, play-services-wallet). Using gradlew to inspect dependencies is the most effective way to find out which libraries are causing the version conflict.