3

I have a one main project and second project (module).

After I import the module project as a module dependency into app project and try to sync everything, I get the following error:

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve project :module.
Could not resolve project :module.
Required by: project :app
Unable to find a matching configuration of project :module:
 - Configuration 'debugApiElements':
     - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
     - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Apk'.
     - 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 'debugMetadataElements':
     - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
     - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Metadata'.
     - Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.
     - Required org.gradle.api.attributes.Usage 'java-api' but no value provided.
 - Configuration 'debugRuntimeElements':
     - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
     - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Apk'.
     - 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 'debug' and found incompatible value 'release'.
     - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Apk'.
     - 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 'releaseMetadataElements':
     - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found incompatible value 'release'.
     - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Metadata'.
     - Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but wasn't required.
     - Required org.gradle.api.attributes.Usage 'java-api' but no value provided.
 - Configuration 'releaseRuntimeElements':
     - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found incompatible value 'release'.
     - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Apk'.
     - 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'.

My dependency in main app.gradle:

compile project(':module')

I found out that if I change it to the following:

compile project(path: ':module', configuration:'default')

Then the project synchronizes and builds.

However in main project class files I am unable to import any files from the module project.

Spent already couple hours searching for answers and nothing I've found so far helps. Went as far as to reinstalling Android Studio 3.0 but it didn't help.

Sneh Pandya
  • 8,197
  • 7
  • 35
  • 50
zemaitis
  • 203
  • 2
  • 12
  • This question has the information you need: https://stackoverflow.com/questions/44390590/android-studio-3-0-error-migrate-dependency-configurations-for-local-modules – PhilipSa Nov 12 '17 at 18:53
  • Didn't help. This is how my app gradle look like: https://pastebin.com/k58KWq1z And my testmodule https://pastebin.com/rj1tbt1i – zemaitis Nov 12 '17 at 20:21

1 Answers1

12

Solved my problem.

I created test module using apply plugin: 'com.android.application' when it should be using apply plugin: 'com.android.library'.

While you can have multiple application modules in a project, you cannot have application modules depend on other application modules.

zemaitis
  • 203
  • 2
  • 12
  • if that would be the case how am i gonna be able to use features of the other project? Please answer – sshanzel Mar 06 '20 at 13:13