You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React Native应用运行失败:':react-native-fast-image'项目配置错误修复指导请求

Hey, let's break down what's going wrong here and fix it step by step.

Your core issues are two-fold:

  1. JCenter is no longer maintained and its SSL certificate has expired — that's why you're seeing those PKIX path validation failed errors when trying to pull Kotlin dependencies from it.
  2. The react-native-fast-image package you're using relies on an outdated Gradle plugin (3.4.0) that's incompatible with newer Gradle versions like 7.0.

Here's how to fix this:

Step 1: Replace JCenter with active repositories

First, update your project's repository sources to use maintained alternatives like Maven Central and Google's repository:

  • Go to your project root's build.gradle file (not the one inside the app folder)
  • Find the allprojects > repositories block and replace any jcenter() entries with mavenCentral(), making sure google() is included too:
    allprojects {
        repositories {
            google()
            mavenCentral()
            mavenLocal()
            maven { url "$rootDir/../node_modules/react-native/android" }
            // Keep any other necessary repositories (like for other native packages)
        }
    }
    
  • You'll also need to check the react-native-fast-image module's build config. Navigate to node_modules/react-native-fast-image/android/build.gradle and update its repositories section the same way — remove jcenter() and add mavenCentral() + google().

Step 2: Upgrade react-native-fast-image to a modern version

The old version of react-native-fast-image uses a deprecated Gradle plugin. Upgrading it will resolve compatibility issues:
Run this command in your project root:

# Using npm
npm install react-native-fast-image@latest --save

# Or using yarn
yarn add react-native-fast-image@latest

After upgrading, clean your build cache and rebuild:

npx react-native clean
npx react-native run-android

Step 3: Fix PKIX certificate issues (if still present)

If you still see certificate errors after switching repositories, try these:

  • Update your JDK: Use a recent JDK version (11 or newer) — older versions might lack up-to-date SSL certificates.
  • Temporary insecure access (dev only): If you're in a development environment and need a quick fix, allow insecure protocol for Maven Central in your Gradle config (don't do this for production):
    repositories {
        mavenCentral {
            url "https://repo1.maven.org/maven2/"
            allowInsecureProtocol = true
        }
    }
    

To avoid future compatibility issues, upgrade your project's Gradle version to match modern standards:

  1. Open gradle/wrapper/gradle-wrapper.properties and update the distribution URL:
    distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
    
  2. Open your root build.gradle and update the Android Gradle plugin version to match (7.4.2 works with Gradle 7.5):
    dependencies {
        classpath "com.android.tools.build:gradle:7.4.2"
        // If you use Kotlin, upgrade the kotlin-gradle-plugin to a compatible version too
    }
    

After following these steps, your build should resolve the dependency issues and run successfully.

内容的提问来源于stack exchange,提问作者my account

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.01 00:39:09