React-native无法运行android

use*_*559 11 android react-native

接下来:https://facebook.github.io/react-native/docs/getting-started.html,我创建了一个空项目,并试图通过执行来运行它:sudo react-native run-android这是生产什么:

Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug...
Downloading https://services.gradle.org/distributions/gradle-2.4-all.zip

Exception in thread "main" javax.net.ssl.SSLHandshakeException: 

sun.security.validator.ValidatorException: PKIX path building failed: 

sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Run Code Online (Sandbox Code Playgroud)

(如果有用,我可以发布剩下的错误).有人有建议吗?

小智 18

更改分发网址:

android/gradle/wrapper/gradle-wrapper.properties

httpshttp.


Ayu*_*ani 4

使用以下步骤我解决了该错误:

  1. 打开 build.gradle (node-modules/react-native/ReactAndroid)
  2. 使用 http://mirror.nienbo.com/boost/1.57.0/boost_1_57_0.zip更改任务 downloadBoost的src路径

    task downloadBoost(dependsOn: createNativeDepsDirectories, type: Download) {
        // Use ZIP version as it's faster this way to selectively extract some parts of the archive
        //src 'https://downloads.sourceforge.net/project/boost/boost/1.57.0/boost_1_57_0.zip'
        // change
        src 'http://mirror.nienbo.com/boost/1.57.0/boost_1_57_0.zip'
        onlyIfNewer true
        overwrite false
        dest new File(downloadsDir, 'boost_1_57_0.zip')
    }
    
    Run Code Online (Sandbox Code Playgroud)
  3. 执行 Gradle 同步

    工具 -> Android -> 将项目与 Gradle 文件同步