Android Studio 3.0 Compile Issue (Cannot choose between Configurations)
Try
implementation project(path: ':lp_messaging_sdk', configuration: 'default')
Note:
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.
ANDROID STUDIO 3.0 upgrade : Error:Could not resolve all files for configuration ':app:xxxxxxxDebugCompileClasspath'
change dependency declaration
from
compile files('libs/commons-lang-2.4.jar')
to
implementation files('libs/commons-lang-2.4.jar')
flavorDimensions gradle error - Android Studio 3.0 Canary 1
Seems like a bug in the Gradle build process, I'm not quite sure why exactly it's not working. I was stuck on this for a while but I was able to fix it by changing
compile project(':util')
to
compile project(path: ':util', configuration: 'default')
Let me know if this works for you!
Android studio 3.0: Unable to resolve dependency for :app@dexOptions/compileClasspath': Could not resolve project :animators
With Android Studio 2.3(AS) the project works fine and i can able to run the App. After updating the AS to Android Studio 3.0. i too got the error as below for libraries and build types.
Unable to resolve dependency for ':app@dexOptions/compileClasspath': Could not resolve project : library_Name.
Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve project : library_Name.
To Solve the issue, simply.
What ever the
buildTypes{
debug{ ... }
release{ ... }
}
you have in your (app) build.gradle file, You have to include all the buildTypes{ }
with same names as like
buildTypes{
debug{ ... }
release{ ... }
}
in to build.gradle
files of All libraries/modules included in project.
clean and rebuild the project, the issue will be fixed.
Still issue not fixed, update the gradle-wrapper.properties to
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
Unable to resolve dependency Android Studio 3.0
After some research I have solved this issue.
Step 1-:
I disable the Gradle offline work in settings.
File > Settings > Build, Execution, Deployment > Gradle > Uncheck Offline Work
Step 2-:
Then, I just changed compile 'com.facebook.android:account-kit-sdk:4.+'
to api 'com.facebook.android:account-kit-sdk:4.+'
I don't know exactly why it's work. I see api in docs Reference
Now it works :)
EDIT -
Now, I am able to use both api
or implementation
and everything works fine.
Thanks,
Android Studio 3.0 Error. Migrate dependency configurations for local modules
Google added more instruction how to solve it: Resolve build errors related to dependency matching
Cause of build error:
Your app includes a build type that a library dependency does not.
For example, your app includes a "staging" build type, but a
dependency includes only a "debug" and "release" build type.Note that there is no issue when a library dependency includes a build
type that your app does not. That's because the plugin simply never
requests that build type from the dependency.
Resolution
Use matchingFallbacks to specify alternative matches for a given build type, as shown below:
// In the app's build.gradle file.
android {
buildTypes {
debug {}
release {}
staging {
// Specifies a sorted list of fallback build types that the
// plugin should try to use when a dependency does not include a
// "staging" build type. You may specify as many fallbacks as you
// like, and the plugin selects the first build type that's
// available in the dependency.
matchingFallbacks = ['debug', 'qa', 'release']
}
}
}
Related Topics
Install App via Usb: the Device Is Temporarily Restricted
Set Visibility in Menu Programmatically Android
How to Check If Running on UI Thread in Android
Do Gcm Registration Id's Expire
Triggering Event When Button Is Pressed Down in Android
Android: Google Maps Location with Low Battery Usage
Getting Header from Response (Retrofit/Okhttp Client)
Can Gradientcolor Be Used to Define a Gradient for a Fill or Stroke Entirely in Xml
Multiple Apps Use Same Content Provider
Communicating with Serial Usb Device Over Android
Android Studio: Default Project Directory
Newer Versions of Android Studio and Only Two Drawable Directory - Drawable and Drawable-V21
How to Detect Bluetooth State Change Using a Broadcast Receiver
How to Dynamically Change an App Icon Like Calendar App Does