猿问

Android studio 3.0:无法解析依赖:app @ dexOptions

Android studio 3.0:无法解析依赖:app @ dexOptions 

我迁移到Android studio 3.0。因此,项目无法编译名为“:animator”的模块,它会显示以下错误:


 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>

并显示详细信息提供此日志:


 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'.

     


缥缈止盈
浏览 1137回答 3
3回答

千万里不及你

如官方迁移指南中所述,在以下情况下会遇到此错误:您的应用程序包含库依赖项不包含的构建类型android {&nbsp; buildTypes {&nbsp; &nbsp; &nbsp; release {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...&nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; dexOptions {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...&nbsp; &nbsp; &nbsp; &nbsp; // release & debug is in project animators&nbsp; &nbsp; &nbsp; &nbsp; matchingFallbacks = ['release', 'debug']&nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; debug {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...&nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; }}设置匹配配置回退显然是解决这个问题的正确方法。

红颜莎娜

确保你在项目中单击文件&nbsp;>&nbsp;设置(在Mac上,&nbsp;Android Studio&nbsp;>&nbsp;首选项)打开首选项。在左窗格中,单击“&nbsp;生成”,“执行”,“部署&nbsp;”>>“&nbsp;Gradle”。取消选中&nbsp;/&nbsp;禁用该Offline work复选框。单击应用或确定。
随时随地看视频慕课网APP

相关分类

Android
我要回答