1
votes

Hello I am developing and SDK, and for test I am importing in an other project

For do this I do click into file -> new -> import module.

After this I update the app.gradle with

implementation project(':sdk')

The when I sync the project I get the following errors:

ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve project :sdk. Show Details Affected Modules: app

ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve project :sdk. Show Details Affected Modules: app

ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve project :sdk. Show Details Affected Modules: app

Then for solve this I change the gradle line for:

implementation project(':sdk', configuration: 'default')

After this the errors doesn't appear but I can not import anything of the sdk.

Without this when I clean the proyect I get the following:

Cannot choose between the following variants of project :sdk:

  • devDebugApiElements
  • prodDebugApiElements All of them match the consumer attributes:
  • Variant 'devDebugApiElements':
    • Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
    • Found com.android.build.api.attributes.VariantAttr 'devDebug' but wasn't required.
    • Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
    • Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
    • Found version 'dev' but wasn't required.
  • Variant 'prodDebugApiElements':
    • Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
    • Found com.android.build.api.attributes.VariantAttr 'prodDebug' but wasn't required.
    • Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
    • Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
    • Found version 'prod' but wasn't required.

Any idea about how can fix this problem?

Thanks

1

1 Answers

3
votes

It seems like you are using flavors in your sdk project, so the project that imports your sdk does not know which of those flavors to build. You have to have the same flavors and dimensions in your project that imports your sdk.