Android Studio 3.0 Compile Issue (Cannot choose between Configurations)


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


You can avoid this bug by update gradle to 4.3 check this.

Explanation :

Using Dependency Configurations makes it easy to define and specify what to use in sub-project.

In my answer, we used default configuration and this will publish and expose only the “release” flavor to other Android projects and modules.

Assume you need to include this flavor only with demo flavor or with release flavor, it would be like :

configurations {
  // Initializes placeholder configurations that the Android plugin can use when targeting
  // the corresponding variant of the app.
  demoDebugCompile {}
  fullReleaseCompile {}
dependencies {
  // If the library configures multiple build variants using product flavors,
  // you must target one of the library's variants using its full configuration name.
  demoDebugCompile project(path: ':lp_messaging_sdk', configuration: 'demoDebug')
  fullReleaseCompile project(path: ':lp_messaging_sdk', configuration: 'fullRelease')

And so, in your case, you may use your build flavors, and that’s what appeared in the error log.

Cannot choose between the following configurations of project :lp_messaging_sdk

And that’s mean, that your lp_messaging_sdk have various build configurations:-

  - debugApiElements
  - debugRuntimeElements
  - releaseApiElements
  - releaseRuntimeElements

And android-studio telling you, that “I can’t choose one configuration from these various, Would you define one for me?”

You can read more over here.

Error:Cannot choose between the following configurations of project…….

There may be gradle writing problems
When I changed to the following wording there is no such error

// compile project(‘:MPChartLib’)

implementation project(':MPChartLib')

Maybe when the reference depends on other modules should be written in this implementation

If you’re using the android-apt plugin for annotation processing, try removing that plugin and replacing all of the apt some_dependency references with annotationProcessor some_dependency as suggested in the migration guide for the Android Gradle Plugin 3.0.0.

Leave a Comment