美文网首页
“Error:Cannot choose between the

“Error:Cannot choose between the

作者: 醉挽清风_666 | 来源:发表于2020-11-17 13:29 被阅读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.
    • 解决方案:
      1、 project的 build.gradle文件,删除“ apt”配置:
      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 "引用项" //新方式

    相关文章

      网友评论

          本文标题:“Error:Cannot choose between the

          本文链接:https://www.haomeiwen.com/subject/vsyxiktx.html