Android build failed: 'Failed to list versions for com.facebook.react:react-native.'
Problem
Description What went wrong: Could not determine the dependencies of task ':app:compileDebugKotlin'. > Could not resolve all files for configuration ':app:debugRuntimeClasspath'. > Could not resolve com.facebook.react:react-native:+. Required by: project :app project :app > project :react-native-push-notification project :app > project :react-native-code-push project :app > project :react-native-async-storage_async-storage project :app > project :react-native-community_blur project :app > project :react-native-community_clipboard project :app > project :react-native-community_datetimepicker project :app > project :react-native-community_masked-view project :app > project :react-native-community_netinfo project :app > project :react-native-community_picker project :app > project :react-native-firebase_analytics project :app > project :react-native-firebase_app project :app > project :react-native-firebase_crashlytics project :app > project :sumsub_react-native-mobilesdk-module project :app > project :react-native-action-sheet project :app > project :react-native-appsflyer project :app > project :react-native-camera project :app > project :react-native-config project :app > project :react-native-device-info project :app > project :react-native-fbsdk-next project :app > project :reac
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Fix Dependency Resolution for React Native in Android Build
The build failed because the Gradle build system could not resolve the dependency for 'com.facebook.react:react-native'. This is often due to an incorrect version specification, missing repositories, or network issues preventing access to the required artifacts.
Awaiting Verification
Be the first to verify this fix
- 1
Specify React Native Version
Update the build.gradle file to specify a fixed version of React Native instead of using a dynamic version ('+'). This helps avoid issues with dependency resolution.
groovyimplementation 'com.facebook.react:react-native:0.71.0' - 2
Add Maven Repository
Ensure that the Maven Central repository is included in your build.gradle file. This is where the React Native artifacts are hosted.
groovyrepositories { mavenCentral() } - 3
Clear Gradle Cache
Sometimes, Gradle may have cached an invalid state. Clear the Gradle cache to force it to re-download dependencies.
bashgradlew cleanBuildCache - 4
Sync Project with Gradle Files
After making changes to the build.gradle file, sync the project with Gradle files in Android Studio to apply the changes.
noneClick 'Sync Now' in the notification bar after editing build.gradle. - 5
Check Network Connectivity
Ensure that your development machine has a stable internet connection to download dependencies from the repositories.
bashping google.com
Validation
To confirm the fix worked, rebuild the project in Android Studio. If the build completes successfully without dependency resolution errors, the issue is resolved.
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep