dialogflow-android-client: Gradle sync failed: Cannot choose between the following configurations of project :ailib:

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)

About this issue

Most upvoted comments

imported external model change like as belove :-

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

same issue ,do u have got an anwser?

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.

@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')
}

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

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

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?

Yes, this is the solution. Thanks @PratikPagada

thank you very much. @PratikPagada

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

Thanks