13

Following this: https://facebook.github.io/react-native/docs/getting-started.html , I've created an empty project and am trying to run it by doing: sudo react-native run-android This is what is produced:

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

(I can post the rest of the error if that would be useful). Does anyone have any advice?

user3738559
  • 183
  • 1
  • 5

3 Answers3

19

Change the distribution url in:

android/gradle/wrapper/gradle-wrapper.properties

from https to http.

Satan Pandeya
  • 3,747
  • 4
  • 27
  • 53
user1344506
  • 191
  • 1
  • 2
4

Using the following steps i resolved the error :

  1. Open build.gradle (node-modules/react-native/ReactAndroid)
  2. Change src path of task downloadBoost with http://mirror.nienbo.com/boost/1.57.0/boost_1_57_0.zip

    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')
    }
    
  3. Perform Gradle Sync

    Tools -> Android -> Sync Project with Gradle Files

Ayush Nawani
  • 654
  • 6
  • 16
0

Chang the distribution url in /android/gradle/wrapper/gradle-wrapper.properties from https to http and also change the gradle version from 5.4 to 5.5