PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

安装下面博客导入key  (仓库服务  这个网址)

关于gradle Cause: unable to find valid certification path to requested target错误解决方法   

仓库服务  这个网址内容加入加入 google 、jcenter

导入网站证书

keytool.exe  -importcert   -file D:\Users\Desktop\cert.cer  -keystore   "%JAVA_HOME%/jre/lib/security/cacerts"  -trustcacerts

buildscript {
    repositories {
        //google()
        //jcenter()
        google { url 'https://maven.aliyun.com/repository/google' }
        jcenter { url 'https://maven.aliyun.com/repository/jcenter' }
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.1.0"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
       //google()
        //jcenter()
        google { url 'https://maven.aliyun.com/repository/google' }
        jcenter { url 'https://maven.aliyun.com/repository/jcenter' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Q:

Installed Build Tools revision 31.0.0 is corrupted. Remove and install again using the SDK Manager.

找到自己 sdk 的目录位置,默认在 %AppData%\Local\Android\Sdk\Win + R 快捷键打开启动,输入 %AppData% 即可快速进入;
然后进入目录, build-tools\31.0.0,将 d8.bat 文件名改成 dx.bat;
然后继续找到 build-tools\31.0.0\lib 目录,将 d8.jar 改成 dx.jar 即可

Q:

The minCompileSdk (32) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-31).
Dependency: androidx.appcompat:appcompat-resources:1.5.0.
AAR metadata file: D:\Users\**\.gradle\caches\transforms-2\files-2.1\d4f92dafedf13532cae26856a5476ff6\jetified-appcompat-resources-1.5.0\META-INF\com\android\build\gradle\aar-metadata.properties.

build.gradle 文件

dependencies {

    implementation 'androidx.appcompat:appcompat:1.5.0'

androidx.appcompat:appcompat:1.4.1. 依赖库必须以 android-31 进行编译 ,  ‘androidx.appcompat:appcompat:1.0.0’ 依赖 android-28

将 androidx.appcompat:appcompat:1.5.0  改为  androidx.appcompat:appcompat:1.4.1 就可以了

Q:

Execution failed for task ':app:installDebug'.
> java.util.concurrent.ExecutionException: com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/vmdl934948546.tmp/base.apk (at Binary XML file line #21): com.example.tracepro.MainActivity: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/Theme.TracePro">
    <activity
        android:exported="true"

AndroidManifest.xml 里面添加 android:exported="true"

可能 gradle.properties文件

android.injected.testOnly=false

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐