赞
踩
这种错误可以分为五种情况,主要是学会看日志,自己分析问题逐一排查
看日志,看日志,看日志,重要的事情说三遍,日志在build>sync里。
gradle里面的buildscript字段缺失或者版本过低或过高,找一个能正常启动的项目进行对比就能看出问题:
Could not resolve com.jakewharton:butterknife-compiler:10.1.0
多添加一个maven仓库就行,一般情况是Google的仓库被墙了,如下代码:
- repositories {
- jcenter()
- google()
- maven { url 'https://maven.aliyun.com/repository/public/' }
- maven { url 'https://maven.aliyun.com/repository/google/' }
- // maven { url "http://mvnrepo.alibaba-inc.com/mvn/repository" }
- }
这种情况的话需要调整一下maven仓库的顺序
Could not HEAD 'http://repo1.maven.org/maven2/com/jakewharton/butterknife-compiler/10.1.0/butterknife-compiler-10.1.0.pom'. Received status code 501 from server: HTTPS Required
4. buildtoolversion:找不到的错误
5. 配置输出包打包异常
AS提示`Required com.android.build.api.attributes.BuildTypeAttr 'artificial' and found incompatible value 'debug'.`,详细如下:
- > Could not resolve all artifacts for configuration ':app:hsyuniformArtificialCompileClasspath'.
- > Could not resolve project :hiappconfig.
- Required by:
- project :app
- > Unable to find a matching variant of project :hiappconfig:
- - Variant 'debugApiElements' capability HIAPOSCMP:hiappconfig:unspecified:
- - Incompatible attribute:
- - Required com.android.build.api.attributes.BuildTypeAttr 'artificial' and found incompatible value 'debug'.
方案一:在变体里面添加下面这行代码
- artificial{
- ...
- matchingFallbacks = ['release', 'debug']
- }
方案二:在依赖的module的buildTypes里面配置同名的输出包打包
- artificial{
- ...
- }
Invoke-customs are only supported starting with Android O (--min-api 26)
- compileOptions {
-
- sourceCompatibility JavaVersion.VERSION_1_8
-
- targetCompatibility JavaVersion.VERSION_1_8
-
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。