android - 带有错误trustAnchors参数的Android Studio 4.X.1必须为非空

标签 android ionic-framework gradle android-gradle-plugin capacitor

伙计们,我已经开始使用电容器在Ionic上进行Stater项目。尝试构建Android构建,似乎Android Studio因Gradle问题而失败。
我在下面做了
ionic 电容器运行android
我的build.gradle文件

// 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: "variables.gradle"

allprojects {
    repositories {
        google()
        mavenCentral()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
问题:
Executing tasks: [build] in project /somelocation/android


FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:3.6.1.
     Required by:
         project :
      > Could not resolve com.android.tools.build:gradle:3.6.1.
         > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.6.1/gradle-3.6.1.pom'.
            > Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.6.1/gradle-3.6.1.pom'.
               > java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
      > Could not resolve com.android.tools.build:gradle:3.6.1.
         > Could not get resource 'https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/3.6.1/gradle-3.6.1.pom'.
            > Could not GET 'https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/3.6.1/gradle-3.6.1.pom'.
               > java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
      > Could not resolve com.android.tools.build:gradle:3.6.1.
         > Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.6.1/gradle-3.6.1.pom'.
            > Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.6.1/gradle-3.6.1.pom'.
               > java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
   > Could not resolve com.google.gms:google-services:4.3.3.
     Required by:
         project :
      > Could not resolve com.google.gms:google-services:4.3.3.
         > 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'.
            > Could not GET 'https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.3.3/google-services-4.3.3.pom'.
               > java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
      > Could not resolve com.google.gms:google-services:4.3.3.
         > Could not get resource 'https://repo.maven.apache.org/maven2/com/google/gms/google-services/4.3.3/google-services-4.3.3.pom'.
            > Could not GET 'https://repo.maven.apache.org/maven2/com/google/gms/google-services/4.3.3/google-services-4.3.3.pom'.
               > java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
      > Could not resolve com.google.gms:google-services:4.3.3.
         > Could not get resource 'https://jcenter.bintray.com/com/google/gms/google-services/4.3.3/google-services-4.3.3.pom'.
            > Could not GET 'https://jcenter.bintray.com/com/google/gms/google-services/4.3.3/google-services-4.3.3.pom'.
               > 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'.
我可以使用Ionic命令构建项目,但是我想在模拟器上运行它,因此尝试在Android Studio上打开它。当我尝试使用android studio gradle同步导入时,发生以上异常。在这个问题上的任何方向都将有所帮助。

最佳答案

解决了。当我运行带有OpenJDK版本openjdk-8u41-b04-linux-x64-14_jan_2020的项目时,发生此错误。一旦将其更改为使用OpenJDK 14.0.2,它就可以正常工作。

关于android - 带有错误trustAnchors参数的Android Studio 4.X.1必须为非空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64234117/

相关文章:

android - 使用 gradle 构建时 lint 上的 java.lang.AbstractMethodError

android - 在 Fragment 中以编程方式将 View 添加到另一个 View

angularjs - 使用推送通知推送图片(ngCordova、Angular、Ionic)

android - Android Studio 1.0本地路径不存在

android - 此版本中使用了已弃用的 Gradle 功能,使其与 Gradle 7.0 不兼容。 flutter

android - Xamarin.Forms:从 Iconize 创建一个圆形/圆形按钮

android - 如何在切换抽屉导航时使用 fragment 隐藏软输入键盘

angular - 我们可以将 Angular Material 2 与 Ionic 一起使用吗?

带选项卡的 Angular 6 RouterLink

groovy - 在构建过程中在源中设置 "hard-coded"标志