14

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?

3
  • Retry download, should resolve the problem Commented May 28, 2016 at 6:48
  • Try this solution: stackoverflow.com/questions/21076179/… Commented Jul 15, 2016 at 11:03
  • i have same problem find any soution ? Commented Feb 3, 2023 at 10:27

4 Answers 4

21

Change the distribution url in:

android/gradle/wrapper/gradle-wrapper.properties

from https to http.

Sign up to request clarification or add additional context in comments.

Comments

4
+50

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

1 Comment

This works. Just want to add that on React Native projects Step 3 is not necessary.
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

Comments

0

Follow these steps

  1. Download the root certificate Open any website in chrome browser then click on the url bar -> connection is secure -> certificate is valid -> Details tab -> export

    Export the above certificate in "Der-encoded binary, single certificate" format. And save the file name example

  2. Save this certificate file in C:\Program Files (x86)\Java\jre\lib\security location.

If you are using mac then save it in /Library/Java/JavaVirtualMachines/zulu-21.jdk/Contents/Home/lib/security/

  1. Run a command

    keytool -import -alias example -keystore "C:\Program Files (x86)\Java\jre\lib\security" -file example.cer

If asked password then provide default password changeit

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.