本文主要是介绍Android studio升级3.0,提示“Error:Cannot choose between the following configurations of project”错误,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Android studio升级到3.0,原来正常的项目,加载编译时,提示“Error:Cannot choose between the following configurations of project”错误:
Error:Cannot choose between the following configurations of project :XXX:- debugApiElements- debugRuntimeElements- releaseApiElements- releaseRuntimeElements
All of them match the consumer attributes:- Configuration 'debugApiElements':- Found com.android.build.api.attributes.BuildTypeAttr 'debug' but wasn't required.- Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required.- Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.- Found org.gradle.api.attributes.Usage 'java-api' but wasn't required.- Configuration 'debugRuntimeElements':- Found com.android.build.api.attributes.BuildTypeAttr 'debug' but wasn't required.- Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required.- Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.- Found org.gradle.api.attributes.Usage 'java-runtime' but wasn't required.- Configuration 'releaseApiElements':- Found com.android.build.api.attributes.BuildTypeAttr 'release' but wasn't required.- Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required.- Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but wasn't required.- Found org.gradle.api.attributes.Usage 'java-api' but wasn't required.- Configuration 'releaseRuntimeElements':- Found com.android.build.api.attributes.BuildTypeAttr 'release' but wasn't required.- Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required.- Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but wasn't required.- Found org.gradle.api.attributes.Usage 'java-runtime' but wasn't required.
解决办法:
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' //删除
2、 module的 build.gradle文件,删除“android-apt”引用:
apply plugin: 'android-apt' //删除
3、 module的 build.gradle文件,修改“dependencies”中的“apt”方式 为“annotationProcessor”方式:
apt "引用项" //老方式,删除
annotationProcessor "引用项" //新方式
这篇关于Android studio升级3.0,提示“Error:Cannot choose between the following configurations of project”错误的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!