title: Ract-Native Android build failed - unable to find valid certification path to requested target
body: <p>I created sample react-native project using "react-native init HelloWorld". I am seeing following error continuously when I run "react-native run-android".  I tried with solutions provided for similar solution at these links. But it it didnt solve the problem.</p>
  
  <p><a href="https://stackoverflow.com/questions/41460313/sun-security-provider-certpath-suncertpathbuilderexception-unable-to-find-valid">Post1</a>
  <a href="https://stackoverflow.com/questions/21076179/pkix-path-building-failed-and-unable-to-find-valid-certification-path-to-requ">Post2</a></p>
  
  <p><strong>Android Build.gradle in react native project:</strong></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>// Top-level build file where you can add configuration options common to all sub-projects/modules.
  
  buildscript {
      ext {
          buildToolsVersion = "27.0.3"
          minSdkVersion = 16
          compileSdkVersion = 27
          targetSdkVersion = 26
          supportLibVersion = "27.1.1"
      }
      repositories {
          jcenter()
          google()
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:3.1.4'
  
          // NOTE: Do not place your application dependencies here; they belong
          // in the individual module build.gradle files
      }
  }
  
  allprojects {
      repositories {
          mavenLocal()
          jcenter()
          maven {
              // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
              url "$rootDir/../node_modules/react-native/android"
          }
          google()
      }
  }
  
  
  task wrapper(type: Wrapper) {
      gradleVersion = '4.4'
      distributionUrl = distributionUrl.replace("bin", "all")
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>gradle-wrapper.properties file in react-native project</strong></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>distributionBase=GRADLE_USER_HOME
  distributionPath=wrapper/dists
  zipStoreBase=GRADLE_USER_HOME
  zipStorePath=wrapper/dists
  distributionUrl=http\://services.gradle.org/distributions/gradle-4.4-all.zip</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>Error:</strong></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>D:\My Projects\PULSE\Phase II\ReactNative\Projects\HellowWorld&gt;react-native run-android
  Starting JS server...
  Building and installing the app on the device (cd android &amp;&amp; gradlew.bat installDebug)...
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Could not resolve all files for configuration ':app:debugCompileClasspath'.
  &gt; Could not resolve com.facebook.infer.annotation:infer-annotation:0.11.2.
    Required by:
        project :app &gt; com.facebook.react:react-native:0.57.0
     &gt; Could not resolve com.facebook.infer.annotation:infer-annotation:0.11.2.
        &gt; Could not get resource 'https://jcenter.bintray.com/com/facebook/infer/annotation/infer-annotation/0.11.2/infer-annotation-0.11.2.pom'.
           &gt; Could not GET 'https://jcenter.bintray.com/com/facebook/infer/annotation/infer-annotation/0.11.2/infer-annotation-0.11.2.pom'.
              &gt; sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
     &gt; Could not resolve com.facebook.infer.annotation:infer-annotation:0.11.2.
        &gt; Could not get resource 'https://dl.google.com/dl/android/maven2/com/facebook/infer/annotation/infer-annotation/0.11.2/infer-annotation-0.11.2.pom'.
           &gt; Could not GET 'https://dl.google.com/dl/android/maven2/com/facebook/infer/annotation/infer-annotation/0.11.2/infer-annotation-0.11.2.pom'.
              &gt; sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
  &gt; Could not resolve com.facebook.fresco:fresco:1.10.0.
    Required by:
        project :app &gt; com.facebook.react:react-native:0.57.0
     &gt; Could not resolve com.facebook.fresco:fresco:1.10.0.
        &gt; Could not get resource 'https://jcenter.bintray.com/com/facebook/fresco/fresco/1.10.0/fresco-1.10.0.pom'.
           &gt; Could not GET 'https://jcenter.bintray.com/com/facebook/fresco/fresco/1.10.0/fresco-1.10.0.pom'.
              &gt; sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
     &gt; Could not resolve com.facebook.fresco:fresco:1.10.0.
        &gt; Could not get resource 'https://dl.google.com/dl/android/maven2/com/facebook/fresco/fresco/1.10.0/fresco-1.10.0.pom'.
           &gt; Could not GET 'https://dl.google.com/dl/android/maven2/com/facebook/fresco/fresco/1.10.0/fresco-1.10.0.pom'.
              &gt; sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
  &gt; Could not resolve com.facebook.fresco:imagepipeline-okhttp3:1.10.0.
    Required by:
        project :app &gt; com.facebook.react:react-native:0.57.0
     &gt; Could not resolve com.facebook.fresco:imagepipeline-okhttp3:1.10.0.
        &gt; Could not get resource 'https://jcenter.bintray.com/com/facebook/fresco/imagepipeline-okhttp3/1.10.0/imagepipeline-okhttp3-1.10.0.pom'.
           &gt; Could not GET 'https://jcenter.bintray.com/com/facebook/fresco/imagepipeline-okhttp3/1.10.0/imagepipeline-okhttp3-1.10.0.pom'.
              &gt; sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
     &gt; Could not resolve com.facebook.fresco:imagepipeline-okhttp3:1.10.0.
        &gt; Could not get resource 'https://dl.google.com/dl/android/maven2/com/facebook/fresco/imagepipeline-okhttp3/1.10.0/imagepipeline-okhttp3-1.10.0.pom'.
           &gt; Could not GET 'https://dl.google.com/dl/android/maven2/com/facebook/fresco/imagepipeline-okhttp3/1.10.0/imagepipeline-okhttp3-1.10.0.pom'.
              &gt; sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
  &gt; Could not resolve com.facebook.soloader:soloader:0.5.1.
    Required by:
        project :app &gt; com.facebook.react:react-native:0.57.0
     &gt; Could not resolve com.facebook.soloader:soloader:0.5.1.
        &gt; Could not get resource 'https://jcenter.bintray.com/com/facebook/soloader/soloader/0.5.1/soloader-0.5.1.pom'.
           &gt; Could not GET 'https://jcenter.bintray.com/com/facebook/soloader/soloader/0.5.1/soloader-0.5.1.pom'.
              &gt; sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
     &gt; Could not resolve com.facebook.soloader:soloader:0.5.1.
        &gt; Could not get resource 'https://dl.google.com/dl/android/maven2/com/facebook/soloader/soloader/0.5.1/soloader-0.5.1.pom'.
           &gt; Could not GET 'https://dl.google.com/dl/android/maven2/com/facebook/soloader/soloader/0.5.1/soloader-0.5.1.pom'.
              &gt; sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
  &gt; Could not resolve com.google.code.findbugs:jsr305:3.0.2.
    Required by:
        project :app &gt; com.facebook.react:react-native:0.57.0
     &gt; Could not resolve com.google.code.findbugs:jsr305:3.0.2.
        &gt; Could not get resource 'https://jcenter.bintray.com/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.pom'.
           &gt; Could not GET 'https://jcenter.bintray.com/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.pom'.
              &gt; sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
     &gt; Could not resolve com.google.code.findbugs:jsr305:3.0.2.
        &gt; Could not get resource 'https://dl.google.com/dl/android/maven2/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.pom'.
           &gt; Could not GET 'https://dl.google.com/dl/android/maven2/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.pom'.
              &gt; sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
  &gt; Could not resolve com.squareup.okhttp3:okhttp:3.10.0.
    Required by:
        project :app &gt; com.facebook.react:react-native:0.57.0
     &gt; Could not resolve com.squareup.okhttp3:okhttp:3.10.0.
        &gt; Could not get resource 'https://jcenter.bintray.com/com/squareup/okhttp3/okhttp/3.10.0/okhttp-3.10.0.pom'.
           &gt; Could not HEAD 'https://jcenter.bintray.com/com/squareup/okhttp3/okhttp/3.10.0/okhttp-3.10.0.pom'.
              &gt; sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
     &gt; Could not resolve com.squareup.okhttp3:okhttp:3.10.0.
        &gt; Could not get resource 'https://dl.google.com/dl/android/maven2/com/squareup/okhttp3/okhttp/3.10.0/okhttp-3.10.0.pom'.
           &gt; Could not HEAD 'https://dl.google.com/dl/android/maven2/com/squareup/okhttp3/okhttp/3.10.0/okhttp-3.10.0.pom'.
              &gt; sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
  &gt; Could not resolve com.squareup.okhttp3:okhttp-urlconnection:3.10.0.
    Required by:
        project :app &gt; com.facebook.react:react-native:0.57.0
     &gt; Could not resolve com.squareup.okhttp3:okhttp-urlconnection:3.10.0.
        &gt; Could not get resource 'https://jcenter.bintray.com/com/squareup/okhttp3/okhttp-urlconnection/3.10.0/okhttp-urlconnection-3.10.0.pom'.
           &gt; Could not HEAD 'https://jcenter.bintray.com/com/squareup/okhttp3/okhttp-urlconnection/3.10.0/okhttp-urlconnection-3.10.0.pom'.
              &gt; sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
     &gt; Could not resolve com.squareup.okhttp3:okhttp-urlconnection:3.10.0.
        &gt; Could not get resource 'https://dl.google.com/dl/android/maven2/com/squareup/okhttp3/okhttp-urlconnection/3.10.0/okhttp-urlconnection-3.10.0.pom'.
           &gt; Could not HEAD 'https://dl.google.com/dl/android/maven2/com/squareup/okhttp3/okhttp-urlconnection/3.10.0/okhttp-urlconnection-3.10.0.pom'.
              &gt; sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
  &gt; Could not resolve com.squareup.okio:okio:1.14.0.
    Required by:
        project :app &gt; com.facebook.react:react-native:0.57.0
     &gt; Could not resolve com.squareup.okio:okio:1.14.0.
        &gt; Could not get resource 'https://jcenter.bintray.com/com/squareup/okio/okio/1.14.0/okio-1.14.0.pom'.
           &gt; Could not HEAD 'https://jcenter.bintray.com/com/squareup/okio/okio/1.14.0/okio-1.14.0.pom'.
              &gt; sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
     &gt; Could not resolve com.squareup.okio:okio:1.14.0.
        &gt; Could not get resource 'https://dl.google.com/dl/android/maven2/com/squareup/okio/okio/1.14.0/okio-1.14.0.pom'.
           &gt; Could not HEAD 'https://dl.google.com/dl/android/maven2/com/squareup/okio/okio/1.14.0/okio-1.14.0.pom'.
              &gt; sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
  &gt; Could not resolve org.webkit:android-jsc:r174650.
    Required by:
        project :app &gt; com.facebook.react:react-native:0.57.0
     &gt; Could not resolve org.webkit:android-jsc:r174650.
        &gt; Could not get resource 'https://jcenter.bintray.com/org/webkit/android-jsc/r174650/android-jsc-r174650.pom'.
           &gt; Could not HEAD 'https://jcenter.bintray.com/org/webkit/android-jsc/r174650/android-jsc-r174650.pom'.
              &gt; sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
     &gt; Could not resolve org.webkit:android-jsc:r174650.
        &gt; Could not get resource 'https://dl.google.com/dl/android/maven2/org/webkit/android-jsc/r174650/android-jsc-r174650.pom'.
           &gt; Could not HEAD 'https://dl.google.com/dl/android/maven2/org/webkit/android-jsc/r174650/android-jsc-r174650.pom'.
              &gt; sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
  
  * Get more help at https://help.gradle.org
  
  BUILD FAILED in 27s
  1 actionable task: 1 executed
  Could not install the app on the device, read the error above for details.
  Make sure you have an Android emulator running or a device connected and have
  set up your Android development environment:
  https://facebook.github.io/react-native/docs/getting-started.html</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>Following are the react-native versions I am using</strong>
  <a href="https://i.stack.imgur.com/GXVmr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GXVmr.png" alt="enter image description here"></a></p>