Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failed to add this sample as module #27

Open
elirangoshen opened this issue Jan 9, 2018 · 1 comment
Open

failed to add this sample as module #27

elirangoshen opened this issue Jan 9, 2018 · 1 comment

Comments

@elirangoshen
Copy link

i dded another project as module and tried to add this starter in gradle using this line :

implementation project(path: ':library')

and when i'm trying to sync i'm getting the following error :

Unable to resolve dependency for ':sample@debug/compileClasspath': Could not resolve project :library.

Could not resolve project :library.
Required by:
project :sample

Unable to find a matching configuration of project :library:
- 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.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.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.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.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.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.usage 'java-api' and found incompatible value 'java-runtime'.

i researched it on stack overflow, and the only thing that almost worked for me is to rename my gradle line to this :

implementation project(path: ':library', configuration: 'default')

my sync did work, but i couldn't import any of the project files.

i know that the issue is that the configurations is not identical , but i don't know what i should do to fix this.

@okiloki
Copy link

okiloki commented Mar 18, 2018

This is the problem

  • Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Apk'.

I had the same trouble. It's because you want to reach values from an App module. You have to convert it to "Android library" type. Try this https://developer.android.com/studio/projects/android-library.html#Convert
I didn't find a way to resolve resources from an app module in another module. The safest way is to organize your project as in this example https://stackoverflow.com/a/34808917

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants