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

Gradle sync failed: Cannot choose between the following configurations of project :ailib: #57

Open
naushad97 opened this issue Aug 13, 2017 · 27 comments

Comments

@naushad97
Copy link

@naushad97 naushad97 commented Aug 13, 2017

Build is failing for Android Client in Android Studio 3.0. Beta 2.

Gradle sync failed: Cannot choose between the following configurations of project :ailib:
				- debugApiElements
				- debugRuntimeElements
				- releaseApiElements
				- releaseRuntimeElements
				All of them match the consumer attributes:
				- Configuration 'debugApiElements':
				- Found com.android.build.api.attributes.BuildTypeAttr 'debug' but wasn't required.
				- Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required.
				- Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.
				- Found org.gradle.api.attributes.Usage 'java-api' but wasn't required.
				- Configuration 'debugRuntimeElements':
				- Found com.android.build.api.attributes.BuildTypeAttr 'debug' but wasn't required.
				- Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required.
				- Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.
				- Found ... (show balloon)
@ngreedy

This comment has been minimized.

Copy link

@ngreedy ngreedy commented Oct 17, 2017

same issue ,do u have got an anwser?

@naderz

This comment has been minimized.

Copy link

@naderz naderz commented Oct 30, 2017

Same issue ....

2 similar comments
@lixuebo0630

This comment has been minimized.

Copy link

@lixuebo0630 lixuebo0630 commented Oct 30, 2017

Same issue ....

@smilelyj

This comment has been minimized.

Copy link

@smilelyj smilelyj commented Nov 1, 2017

Same issue ....

@matheusaguiardev

This comment has been minimized.

Copy link

@matheusaguiardev matheusaguiardev commented Nov 1, 2017

Same issue...

@PratikPagada

This comment has been minimized.

Copy link

@PratikPagada PratikPagada commented Nov 2, 2017

imported external model change like as belove :-

compile project(':linkedin-sdk')
to
compile project(path: ':linkedin-sdk', configuration: 'default')

@xrnd

This comment has been minimized.

Copy link

@xrnd xrnd commented Nov 3, 2017

Yes, this is the solution. Thanks @PratikPagada

@Ganeshk365

This comment has been minimized.

Copy link

@Ganeshk365 Ganeshk365 commented Nov 15, 2017

Thank you pratikpagada its works , i just like to know why we putting configuration: 'default'

@Bubcho

This comment has been minimized.

Copy link

@Bubcho Bubcho commented Nov 16, 2017

Even better, replace the now deprecated compile configuration with implementation or api, like this:
compile project(':linkedin-sdk')
becomes
implementation project(':linkedin-sdk')

See this for reference.

@PratikPagada

This comment has been minimized.

Copy link

@PratikPagada PratikPagada commented Nov 17, 2017

@Ganeshk365 If you're using Android plugin for Gradle 3.0.0 or higher, the plugin automatically matches each variant of your app with corresponding variants of its local library module dependencies for you. That is, you should no longer target specific variants of local module dependencies, show as below

dependencies {
  // Adds the 'debug' varaint of the library to the debug varaint of the app
  debugCompile project(path: ':my-library-module', configuration: 'debug')

  // Adds the 'release' varaint of the library to the release varaint of the app
  releaseCompile project(path: ':my-library-module', configuration: 'release')
}
@PengJunJun

This comment has been minimized.

Copy link

@PengJunJun PengJunJun commented Nov 23, 2017

thank you very much. @PratikPagada

@Caguillo

This comment has been minimized.

Copy link

@Caguillo Caguillo commented Dec 16, 2017

@PratikPagada

Hi,
I am stuck..
where to change this solution / in which file?

compile project(':linkedin-sdk')
to
compile project(path: ':linkedin-sdk', configuration: 'default')

thanks...

@dineshswaas

This comment has been minimized.

Copy link

@dineshswaas dineshswaas commented Feb 12, 2018

Thanks @PratikPagada

@PratikPagada

This comment has been minimized.

Copy link

@PratikPagada PratikPagada commented Feb 12, 2018

Hello @Caguillo

change in the build.gradle file.

@dineshswaas

This comment has been minimized.

Copy link

@dineshswaas dineshswaas commented Feb 12, 2018

i facing this issue after changed- Error:android-apt plugin is incompatible with the Android Gradle plugin. Please use 'annotationProcessor' configuration instead. @PratikPagada

@hariprakash619

This comment has been minimized.

Copy link

@hariprakash619 hariprakash619 commented Feb 12, 2018

Same issues , any fix?

@dineshswaas

This comment has been minimized.

Copy link

@dineshswaas dineshswaas commented Feb 12, 2018

@PratikPagada

This comment has been minimized.

Copy link

@PratikPagada PratikPagada commented Feb 12, 2018

@dineshswaas show me you project level build.gradle file and app level build.gredle file.

@dineshswaas

This comment has been minimized.

Copy link

@dineshswaas dineshswaas commented Feb 12, 2018

@rohangho

This comment has been minimized.

Copy link

@rohangho rohangho commented Feb 24, 2018

Hi, Can anybody tell me why this error? While importing LinkedIn-SDK
121

Thanks

@Sunilkashyap

This comment has been minimized.

Copy link

@Sunilkashyap Sunilkashyap commented Jun 22, 2018

what is the solution this error..

Project with path ':linkedin-sdk' could not be found in root project 'CollegeApp'.

@IgorGanapolsky

This comment has been minimized.

Copy link

@IgorGanapolsky IgorGanapolsky commented Dec 13, 2018

I am getting this error:

Cannot choose between the following variants of project

@glazey132

This comment has been minimized.

Copy link

@glazey132 glazey132 commented Jan 11, 2019

I had a similar issue until I changed how my app was importing the library that has build variants / product flavors.

The import now looks like this:
implementation project(path: ':library-sdk', configuration: 'default')

That resolved the 'cannot choose between the following variants of project' error
but now, my app is unable to resolve dependencies loaded from the library. -_-

@PratikPagada are you familiar at all with what could be going wrong?

@wangmeng88525

This comment has been minimized.

Copy link

@wangmeng88525 wangmeng88525 commented Jan 21, 2019

@glazey132 ,I had the same issue ,do you have got an anwser?

@samramez

This comment has been minimized.

Copy link

@samramez samramez commented Feb 5, 2019

I have the same issue as @glazey132 and @wangmeng88525
Were you guys able to fix this?

@hi-dhl

This comment has been minimized.

Copy link

@hi-dhl hi-dhl commented Feb 13, 2019

for AndroidStudio 3.0+, mainMoudle has buildTypes and buildTypes as same as libModule buildTypes and buildTypes ,it would like:

mainModule

buildTypes {
    release {
        buildConfigField "boolean", "LOG_DEBUG", "false"
        zipAlignEnabled true
        shrinkResources true
        minifyEnabled true
        proguardFiles 'proguard-rules.pro'
    }

    debug {
        buildConfigField "boolean", "LOG_DEBUG", "true"
        zipAlignEnabled true
        shrinkResources false
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }

    debug2{

    }
}

libModule:

buildTypes {
    release {

    }

    debug {

    }

    debug2{

    }
}

or you can use matchingFallbacks solve this click

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.