Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/189.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native无法运行android_Android_React Native - Fatal编程技术网

React native无法运行android

React native无法运行android,android,react-native,Android,React Native,以下是:, 我创建了一个空项目,正在尝试通过执行以下操作来运行它: sudo react本机运行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-al

以下是:, 我创建了一个空项目,正在尝试通过执行以下操作来运行它: sudo react本机运行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

(如果有用的话,我可以发布错误的其余部分)。有人有什么建议吗?

我通过以下步骤解决了错误:

  • 打开build.gradle(节点模块/react-native/reactor-droid)
  • 使用更改任务下载Boost的路径

  • 执行梯度同步

    工具->安卓->与Gradle文件同步项目


  • 在以下位置更改分发url:

    android/gradle/wrapper/gradle wrapper.properties


    https
    http

    将/android/gradle/wrapper/gradle-wrapper.properties中的分发url从https更改为http,并将gradle版本从5.4更改为5.5

    重试下载,应该可以解决问题尝试此解决方案:这很有效。只想补充一点,在React原生项目中,步骤3是不必要的。
    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')
    }