Android Studio 3.0:无法解析:app@dexOptions/compileClasspath'的依赖关系:无法解析项目:animators
Posted
技术标签:
【中文标题】Android Studio 3.0:无法解析:app@dexOptions/compileClasspath\'的依赖关系:无法解析项目:animators【英文标题】:Android studio 3.0: Unable to resolve dependency for :app@dexOptions/compileClasspath': Could not resolve project :animatorsAndroid Studio 3.0:无法解析:app@dexOptions/compileClasspath'的依赖关系:无法解析项目:animators 【发布时间】:2018-04-07 13:24:40 【问题描述】:我迁移到 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
':app@dexOptions/compileClasspath': 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'.
- 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 3.0 一起运行的第一个临时解决方案,我维护 distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip , compileSdkVersion 25 和 buildToolsVersion "25.0.3" 和 classpath 'com.android.tools.build:gradle:2.3.3' @ImeneNoomene,JackHuang 的答案应该是选择的答案。它基于官方文档,而 Sackurise 所说的并不总是可行的(想想 React Native 项目,你的大部分模块都来自 Web) 由于多风味库,我遇到了这个问题。解决自:***.com/a/48718124/1099884 我通过更新Android Studio
解决了我的问题
【参考方案1】:
Step 1:
1.Open the Preferences, by clicking File > Settings (on Mac, Android Studio > Preferences).
2.In the left pane, click Build, Execution, Deployment >> Gradle.
3.Uncheck/disable the Offline work checkbox.
4.Click Apply or OK.
Step 2:
downgrade the gradle-wrapper.properties content which you can access this
file directory by clicking on CTRL + SHFT +R KEY
e.g from
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
to
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip
or to any lower version like /gradle-3.9-all.zip or /gradle-3.8-all.zip
【讨论】:
【参考方案2】:试试这个我已经通过评论下面的行来解决我的问题
依赖
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
//compileOnly 'com.android.support.test:runner:1.0.1'
//compileOnly 'com.android.support.test.espresso:espresso-core:3.0.1'
//androidTestImplementation 'junit:junit:4.12'
【讨论】:
以上是关于Android Studio 3.0:无法解析:app@dexOptions/compileClasspath'的依赖关系:无法解析项目:animators的主要内容,如果未能解决你的问题,请参考以下文章
Android Studio 3.0 任务执行失败:无法合并 dex
无法重命名资源(布局)文件(已安装 Android Studio 3.0 Beta 3)
无法解析符号“android:TextApperance.Material”Android Studio
无法解析符号 JSONObject (Android Studio)