报错1:Could not resolve all files for configuration ':app:debugCompileClasspath'. > Could not resolve com.android.support:appcompat-v7:29+. Required by: project :app > Failed to list versions for com.android.support:appcompat-v7. > Unable to load Maven meta-data from https://dl.google.com/dl/android/maven2/com/android/support/appcompat-v7/maven-metadata.xml. > Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/support/appcompat-v7/maven-metadata.xml'. > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target 修改步骤:进入到app的build.greadle中,将第二行原先的'v7:29+'版本改成了'v7:25.3.1'版本,应该只要降低到能匹配的当前gradle和插件的版本就行了。
dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'com.android.support:appcompat-v7:25.3.1' implementation 'com.android.support.constraint:constraint-layout:1.1.3' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' }报错2:Could not resolve all files for configuration ':app:debugCompileClasspath'. > Could not download constraint-layout.aar (com.android.support.constraint:constraint-layout:1.1.3) > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/support/constraint/constraint-layout/1.1.3/constraint-layout-1.1.3.aar'. > Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/support/constraint/constraint-layout/1.1.3/constraint-layout-1.1.3.aar'. > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target > Could not download constraint-layout-solver.jar (com.android.support.constraint:constraint-layout-solver:1.1.3) > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/support/constraint/constraint-layout-solver/1.1.3/constraint-layout-solver-1.1.3.jar'. > Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/support/constraint/constraint-layout-solver/1.1.3/constraint-layout-solver-1.1.3.jar'. > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
解决办法来自网络,在app的build.gradle中为buildscript的jcenter指定下载路径。
buildscript { repositories { google() jcenter(){ url "http://jcenter.bintray.com/" } //加上上面这一个路径/ } dependencies { classpath 'com.android.tools.build:gradle:3.2.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } }报错3:Execution failed for task ':app:lintVitalRelease'.> Lint found fatal errors while assembling a release target.
办法来自网络,至于为什么这么配置我也不知道,好几次遇到报错里面有个Lint的都是这么改的;位置依旧是app下的build.gradle。
android { compileSdkVersion 25 buildToolsVersion '28.0.2' defaultConfig { applicationId "com.example.yonghu.spinner_activity" minSdkVersion 21 targetSdkVersion 25 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } ///加上如下代码// lintOptions { checkReleaseBuilds false abortOnError false }//这里截止了/ } }
