执行react-native run-android提示BUILD FAILED,求助问题排查与解决
android.arch.lifecycle:runtime:1.0.0 Hey there, let’s work through this build issue together. The error you’re seeing—missing the android.arch.lifecycle:runtime:1.0.0 artifact when building react-native-device-info—is almost certainly tied to outdated dependencies or repository configuration, since jcenter (where that old artifact was hosted) has been sunset and no longer serves many older packages. Here are the most effective fixes to try:
1. Upgrade react-native-device-info to a newer version
Older versions of this library rely on deprecated Android Architecture Components that are no longer available on jcenter. Upgrading to a modern version will resolve this dependency mismatch:
- Run this command in your project root:
If you’re on an older React Native version (pre-0.60), check the library’s release notes to pick a compatible version (v5.x or later works for RN 0.60+).npm install react-native-device-info@latest --save
2. Clear Gradle’s cached dependencies
Corrupted or outdated local cache can cause Gradle to fail finding valid artifacts. Let’s reset it:
- Navigate to your Android directory:
cd android - Clean the build and refresh dependencies:
./gradlew clean ./gradlew build --refresh-dependencies - (Optional) For a deeper clean, delete your global Gradle cache:
- On Mac/Linux: Remove the
~/.gradle/cachesfolder - On Windows: Remove the
C:\Users\<YourUsername>\.gradle\cachesfolder
- On Mac/Linux: Remove the
3. Update your project’s repository configuration
Since jcenter is no longer maintained, ensure your project uses active repositories like mavenCentral and Google’s repo. Open android/build.gradle and update the allprojects -> repositories block:
allprojects { repositories { google() mavenCentral() // Keep jcenter only if you have other dependencies that still require it jcenter() { content { excludeGroup("android.arch") } } } }
This prioritizes active repos and excludes the problematic arch group from jcenter.
4. Verify Android SDK setup
Let’s rule out SDK-related issues:
- Open Android Studio, go to Tools > SDK Manager
- Ensure you have the Android SDK Build-Tools version specified in your
android/build.gradle(check thebuildToolsVersionvalue) installed - If you’re migrating to AndroidX, make sure you have the AndroidX Repository installed under the SDK Tools tab
5. Enable AndroidX and Jetifier (if not already using)
If your project still uses the old Support Library, enabling AndroidX and Jetifier will automatically migrate third-party dependencies to use modern AndroidX libraries:
- Open
android/gradle.properties - Add or ensure these lines are present:
android.useAndroidX=true android.enableJetifier=true - Re-run the build after saving these changes
After trying these steps, run react-native run-android again—this should resolve the missing dependency error and get your app building again.
内容的提问来源于stack exchange,提问作者SmoggeR_js

