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

Imene Noomene picture Imene Noomene · Oct 26, 2017 · Viewed 262.7k times · Source

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

Answer

Sackurise picture Sackurise · Nov 10, 2017

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.

To Solve the issue, simply.

What ever the

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

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

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

in to build.gradle files of All libraries/modules included in project.

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

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

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