Android Studio 3.0:无法解析:app@dexOptions/compileClasspath'的依赖关系:无法解析项目:animators [英] Android studio 3.0: Unable to resolve dependency for :app@dexOptions/compileClasspath': Could not resolve project :animators

查看:23
本文介绍了Android Studio 3.0:无法解析:app@dexOptions/compileClasspath'的依赖关系:无法解析项目:animators的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我迁移到 Android Studio 3.0.因此,项目无法编译名为:animator"的模块,并显示此错误:

I migrate to Android studio 3.0. So, the project become unable to compile a module named ":animator" and it displays me this error:

 Error:Unable to resolve dependency for
 ':app@dexOptions/compileClasspath': Could not resolve project
 :animators. <a
 href="openFile:/home/mobilepowered/MobilePowered/MyInnovalee/trunk17-10-2017/app/build.gradle">Open
 File</a><br><a href="Unable to resolve dependency for
 &#39;:app@dexOptions/compileClasspath&#39;: Could not resolve project
 :animators.">Show Details</a>

并显示详细信息给出此日志:

and show details gives this log :

 Unable to resolve dependency for ':app@dexOptions/compileClasspath':
 Could not resolve project :animators.

 Could not resolve project :animators. Required by:
     project :app
 Unable to find a matching configuration of project :animators:
      - Configuration 'debugApiElements':
          - Required com.android.build.api.attributes.BuildTypeAttr 'dexOptions' and found incompatible value 'debug'.
          - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and
 found compatible value 'Aar'.
          - Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but
 wasn't required.
          - Required org.gradle.api.attributes.Usage 'java-api' and found compatible value 'java-api'.
      - Configuration 'debugRuntimeElements':
          - Required com.android.build.api.attributes.BuildTypeAttr 'dexOptions' and found incompatible value 'debug'.
          - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and
 found compatible value 'Aar'.
          - Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but
 wasn't required.
          - Required org.gradle.api.attributes.Usage 'java-api' and found incompatible value 'java-runtime'.
      - Configuration 'releaseApiElements':
          - Required com.android.build.api.attributes.BuildTypeAttr 'dexOptions' and found incompatible value 'release'.
          - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and
 found compatible value 'Aar'.
          - Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but
 wasn't required.
          - Required org.gradle.api.attributes.Usage 'java-api' and found compatible value 'java-api'.
      - Configuration 'releaseRuntimeElements':
          - Required com.android.build.api.attributes.BuildTypeAttr 'dexOptions' and found incompatible value 'release'.
          - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and
 found compatible value 'Aar'.
          - Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but
 wasn't required.
          - Required org.gradle.api.attributes.Usage 'java-api' and found incompatible value 'java-runtime'.

推荐答案

使用 Android Studio 2.3(AS) 项目运行良好,我可以运行应用程序.将 AS 更新到 Android Studio 3.0 后.对于库和构建类型,我也遇到了如下错误.

With Android Studio 2.3(AS) the project works fine and i can able to run the App. After updating the AS to Android Studio 3.0. i too got the error as below for libraries and build types.

Unable to resolve dependency for ':app@dexOptions/compileClasspath': Could not resolve project : library_Name.

Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve project : library_Name.

简单地解决问题.

怎么回事

buildTypes{
          debug{ ... }
          release{ ... }
    }

你在你的 (app) build.gradle 文件中,你必须包含所有具有相同名称的 buildTypes{ }

you have in your (app) build.gradle file, You have to include all the buildTypes{ } with same names as like

buildTypes{
      debug{ ... }
      release{ ... }
}

项目中包含的所有库/模块build.gradle 文件中.

清理并重建项目,问题将得到解决.

clean and rebuild the project, the issue will be fixed.

问题仍未解决,请将 gradle-wrapper.properties 更新为

Still issue not fixed, update the gradle-wrapper.properties to

distributionUrl=https://services.gradle.org/distributions/gradle-4.1-all.zip

这篇关于Android Studio 3.0:无法解析:app@dexOptions/compileClasspath'的依赖关系:无法解析项目:animators的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆