Gradle Could Not Resolve Project :linkedin-sdk
Solution 1:
Since you are using the new android plugin 3.x you have to follow the migration guidelines:
Error:Failed to resolve: Could not resolve project :linkedin-sdk.
To resolve this error, you need to specify which build type from "mylibrary" (linkedin-sdk in your case) the Android plugin should match to the app's "staging" build type. You can do this with the buildTypeMatching
property in the app's build.gradle
file, as shown below:
android {
...
// Tells the Android plugin to use a library's 'debug' build type// when a 'staging' build type is not available. You can include// additional build types, and the plugin matches 'staging' to the// first build type it finds from the one's you specify. That is,// if 'mylibrary' doesn't include a 'debug' build type either, the// plugin matches 'staging' with the producer's 'release' build type.
buildTypeMatching 'staging', 'debug', 'release'
}
Edit:
buildTypeMatching
was replaced by matchingFallbacks
.
You can find more info about the variant-aware dependency management
here and here.
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']
}
}
}
Then
Unable to find a matching configuration of project :linkedin-sdk:
You can use
compileproject(path: ':linkedin-sdk', configuration: 'default')
but you can simply use the following to take advantage of variant-aware dependency resolution. .
implementation project(':linkedin-sdk')
You can learn more about the 'implementation'
configuration in the section about new dependency configurations
.
Solution 2:
I have solved my problem. In build.gradle(Module app) buildTypes
must have this structure:
buildTypes {
debug {}
releaseApp {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
releaseSdk {
signingConfig signingConfigs.sdkTest
debuggable true
}
}
and in build.gradle(Module linkedinn-sdk) buildTypes must have same structure. So the new code is:
buildTypes {
debug {}
releaseApp {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
releaseSdk {}
}
Solution 3:
I got similar error that I was able to resolve:
21:13 Gradle sync failed: Cannot choose between the following configurations of project :sTLivenessLibrary:
- 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 'for compile' 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.
I fixed this by changing the compile config:
compile project(':linkedin-sdk')
to
compileproject(path: ':linkedin-sdk', configuration: 'default').
Solution 4:
Yes, it is
implementation project(path: ':linkedin-sdk', configuration: 'default')
works
And you can choose flavour type in left tab Build Variants
Solution 5:
I also faced this issue when updated to android studio 3.0
This was my build types block in app gralde file
buildTypes {
staging {
buildConfigField 'String', 'HOST', '"http://compute.amazonaws.com/"'
buildConfigField 'String', 'REGION_CODE', '"1"'
debuggable true
signingConfig signingConfigs.debug
}
QA {
buildConfigField 'String', 'HOST', '"com.amazo/"'
buildConfigField 'String', 'REGION_CODE', '"92"'
debuggable true
signingConfig signingConfigs.debug
}
notificationTest {
buildConfigField 'String', 'HOST', '"http://a6a"'
buildConfigField 'String', 'REGION_CODE', '"92"'
debuggable true
signingConfig signingConfigs.debug
}
}
and this was my project dependencies
compile project(':slideDateTimePicker')
compile project(':scatter')
I opened scatter build.gradle and slideDateTimePicker build.gradle files and replaced android block with this one.
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
QA {}
notificationTest{}
releaseApp {}
releaseSdk {}
staging{}
}
Post a Comment for "Gradle Could Not Resolve Project :linkedin-sdk"