Reputation: 201
Here's a screenshot...
This line has the error
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
This line are the 2 libraries I added per the popup recommendation.
implementation 'com.android.support:animated-vector-drawable:28.0.0-alpha3'
implementation 'com.android.support:support-media-compat:28.0.0-alpha3'
How can I correct this? I've tried so many of the methods here already but none work for me, so I posted my specific situation. Thanks!
Here's my gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "android.cast.thought.thoughtcastandroid"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
implementation 'com.android.support:animated-vector-drawable:28.0.0-alpha3'
implementation 'com.android.support:support-media-compat:28.0.0-alpha3'
implementation 'com.android.support.constraint:constraint-layout:1.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
wearApp project(':wear')
implementation 'com.synnapps:carouselview:0.1.4'
implementation 'com.google.android.gms:play-services-wearable:+'
implementation project(':iskn_api-release')
}
EDIT Added the gradle file
Upvotes: 2
Views: 8148
Reputation: 3242
For me adding those conflicted dependencies with newer versions in app level gradle solved the issue.
for eg.
def SUPPORT_VERSION = "28.0.0"
implementation "com.android.support:appcompat-v7:${SUPPORT_VERSION}"
implementation "com.android.support:cardview-v7:${SUPPORT_VERSION}"
implementation "com.android.support:design:${SUPPORT_VERSION}"
implementation "com.android.support:recyclerview-v7:${SUPPORT_VERSION}"
implementation "com.android.support:gridlayout-v7:${SUPPORT_VERSION}"
// added below dependencies to resolve conflict
// these dependencies have different version for some different sdk i am using
implementation "com.android.support:support-media-compat:${SUPPORT_VERSION}"
implementation "com.android.support:support-v4:${SUPPORT_VERSION}"
Upvotes: 0
Reputation: 2600
The error says you have 2 versions of the support library included - 26.1.0 as well as 28.0.0-alpha3. This means one of your other libraries has a dependency on version 26.1.0.
Check the dependency tree graph from the terminal using this command:
- gradle app:dependencies
or ./gradlew app:dependencies
- app
is your project module
Find out which library has the same dependency of version 26.1.0 and exclude it in gradle. For example:
dependencies {
implementation('com.android.support:recyclerview-v7:22.2.0') {
exclude group: 'com.android.support', module:'appcompat-v7'
}
}
Upvotes: 0
Reputation: 1
I had a problema with the build.gradle(Module: app) for Android Studio 3.1 (compile SDK versión 28) and i've done this modification
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "lovaton.kinley.conteointerfaz"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
Upvotes: 0
Reputation: 1372
I have tried the gradle code of yours, what I found was that when you are using some other libraries like in this code of yours mentioned below.
wearApp project(':wear')
implementation 'com.synnapps:carouselview:0.1.4'
implementation 'com.google.android.gms:play-services-wearable:+'
implementation project(':iskn_api-release')
Now what happens is when these libraries were formed mostly there SDK version was maybe 26 or 27, so when we add such libraries it shows a conflict of dependencies because we are not using the same SDK version, therefore, there is no perfect solution that I could find out but for this particular case two more dependencies that I added removed the error. The code is shown below.
implementation 'com.android.support:support-v4:28.0.0-alpha3'
implementation 'com.android.support:recyclerview-v7:28.0.0-alpha3'
Kindly add the 2 dependencies in your gradle file if still, the problem arises kindle check the classpath version in project gradle, mine was 3.1.3 same is shown below.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
Hope that solves the issue.
Upvotes: 3