title: Android Studio 4.X.1 with error trustAnchors parameter must be non-empty
body: <p>Guys I have started with stater project on Ionic using Capacitor. Trying to build Android build and seems like Android studio is failing with Gradle issues.</p>
  <p>I have done below</p>
  <p>ionic capacitor run android</p>
  <p>My build.gradle file</p>
  <pre><code>// Top-level build file where you can add configuration options common to all sub-projects/modules.
  
  buildscript {
      
      repositories {
          google()
          mavenCentral()
          jcenter()
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:3.6.1'
          classpath 'com.google.gms:google-services:4.3.3'
  
          // NOTE: Do not place your application dependencies here; they belong
          // in the individual module build.gradle files
      }
  }
  
  apply from: &quot;variables.gradle&quot;
  
  allprojects {
      repositories {
          google()
          mavenCentral()
          jcenter()
      }
  }
  
  task clean(type: Delete) {
      delete rootProject.buildDir
  }
  </code></pre>
  <p>Issue:</p>
  <pre><code>Executing tasks: [build] in project /somelocation/android
  
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  A problem occurred configuring root project 'android'.
  &gt; Could not resolve all artifacts for configuration ':classpath'.
     &gt; Could not resolve com.android.tools.build:gradle:3.6.1.
       Required by:
           project :
        &gt; Could not resolve com.android.tools.build:gradle:3.6.1.
           &gt; Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.6.1/gradle-3.6.1.pom'.
              &gt; Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.6.1/gradle-3.6.1.pom'.
                 &gt; java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
        &gt; Could not resolve com.android.tools.build:gradle:3.6.1.
           &gt; Could not get resource 'https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/3.6.1/gradle-3.6.1.pom'.
              &gt; Could not GET 'https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/3.6.1/gradle-3.6.1.pom'.
                 &gt; java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
        &gt; Could not resolve com.android.tools.build:gradle:3.6.1.
           &gt; Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.6.1/gradle-3.6.1.pom'.
              &gt; Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.6.1/gradle-3.6.1.pom'.
                 &gt; java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
     &gt; Could not resolve com.google.gms:google-services:4.3.3.
       Required by:
           project :
        &gt; Could not resolve com.google.gms:google-services:4.3.3.
           &gt; Could not get resource 'https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.3.3/google-services-4.3.3.pom'.
              &gt; Could not GET 'https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.3.3/google-services-4.3.3.pom'.
                 &gt; java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
        &gt; Could not resolve com.google.gms:google-services:4.3.3.
           &gt; Could not get resource 'https://repo.maven.apache.org/maven2/com/google/gms/google-services/4.3.3/google-services-4.3.3.pom'.
              &gt; Could not GET 'https://repo.maven.apache.org/maven2/com/google/gms/google-services/4.3.3/google-services-4.3.3.pom'.
                 &gt; java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
        &gt; Could not resolve com.google.gms:google-services:4.3.3.
           &gt; Could not get resource 'https://jcenter.bintray.com/com/google/gms/google-services/4.3.3/google-services-4.3.3.pom'.
              &gt; Could not GET 'https://jcenter.bintray.com/com/google/gms/google-services/4.3.3/google-services-4.3.3.pom'.
                 &gt; java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
  
  * 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 436ms
  22:23:51: Task execution finished 'build'.
  </code></pre>
  <p>I am able build the project using Ionic commands but I would like to run this on emulator hence trying to open it on Android studio. When I try to import using android studio gradle sync dies with above exception. Any direction on this issue would help.</p>