title: Could not resolve com.android.tools.build:gradle:3.1.4, react-native run-android
body: <p>I am trying to do my first <code>react-native run-android</code> but I get the following error:</p>
  
  <p>FAILURE: Build failed with an exception.</p>
  
  <ul>
  <li>What went wrong:
  A problem occurred configuring root project 'WithoutExpo'.
  
  <blockquote>
    <p>Could not resolve all files for configuration ':classpath'.
    Could not resolve com.android.tools.build:gradle:3.1.4.
     Required by:
         project :
    Could not resolve com.android.tools.build:gradle:3.1.4.
    Could not get resource '<a href="https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.pom" rel="noreferrer">https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.pom</a>'.
    Could not GET '<a href="https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.pom" rel="noreferrer">https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.pom</a>'.
    java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
    Could not resolve com.android.tools.build:gradle:3.1.4.
    Could not get resource '<a href="https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.pom" rel="noreferrer">https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.pom</a>'.
    Could not GET '<a href="https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.pom" rel="noreferrer">https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.pom</a>'.
    java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty</p>
  </blockquote></li>
  </ul>
  
  <p>My build.gradle file is this: </p>
  
  <pre><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 {
          // mavenCentral()
  
          google()
          // maven {
          //     url "https://maven.google.com"
          // }
          jcenter()
      }
      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()
          google()
          jcenter()
          maven {
              // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
              url "$rootDir/../node_modules/react-native/android"
          }
      }
  }
  
  
  task wrapper(type: Wrapper) {
      gradleVersion = '4.4'
      distributionUrl = distributionUrl.replace("bin", "all")
  }
  </code></pre>
  
  <p>As you can see from the commented out lines, I have tried multiple combinations based to former answers <a href="https://stackoverflow.com/questions/47455411/react-native-failure-build-failed-with-an-exception-could-not-resolve-classp">here</a></p>
  
  <p>The common denominator of every error message is the </p>
  
  <blockquote>
    <p>java.lang.RuntimeException: Unexpected error:
    java.security.InvalidAlgorithmParameterException: the trustAnchors
    parameter must be non-empty</p>
  </blockquote>
  
  <p>I have also tried cd android/ &amp;&amp; gradlew clean, and I have also tried changing gradle versions to classpath. All with the same result.</p>
  
  <p>Any suggestions?</p>