android support libraries must use exact same version? - android

I'm trying to import the following library:
implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.10.0'
but I get the following error when I sync:
All com.android.support libraries must use the exact same version
specification (mixing versions can lead to runtime crashes). Found
versions 28.0.0-rc01, 27.1.0. Examples include
com.android.support:animated-vector-drawable:28.0.0-rc01 and
com.android.support:exifinterface:27.1.0...
I tried adding the following but nothing has helped. How do I fix this?
implementation 'com.android.support:exifinterface-28.0.0-rc01'

Make Sure you have compileSdkVersion 28 and targetSdkVersion 28 in android block in build.gradle file.
also make sure you have appcompat-v7:28.0.0-rc01 in your dependencies block.
Then i think implementation 'com.android.support:exifinterface:28.0.0-rc01' can be added without any problem.
I am pasting my build.gradle (Module:app) for reference.
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.chirag.example.retrofeitdemo"
minSdkVersion 15
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-rc01'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
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'
implementation 'com.android.support:exifinterface:28.0.0-rc01'
}

Related

How to resolve the issue to mixing dependency versions?

I'm getting an error regarding mixing of dependency versions . Few days back it was working absolutely fine but from nowhere the issue popped up .
It's showing : All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0-alpha1, 28.0.0. Examples include com.android.support:customtabs:28.0.0-alpha1 and com.android.support:animated-vector-drawable:28.0.0
I'm using Firebase dependencies also , is it causing any trouble ?
I tried to add some extra dependencies (as popped up) , but nothing is working .
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "namantiwari.epplieschool"
minSdkVersion 21
targetSdkVersion 28
versionCode 7
versionName "1.4"
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:28.0.0-alpha1'
implementation 'com.android.support:customtabs:28.0.0-alpha1'
implementation 'com.android.support:support-vector-drawable:28.0.0-alpha1'
implementation 'com.android.support:support-media-compat:28.0.0-alpha1'
implementation 'com.android.support:support-v4:28.0.0-alpha1'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-messaging:17.3.2'
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'
implementation 'com.google.firebase:firebase-core:16.0.1'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
}
apply plugin: 'com.google.gms.google-services'
Android X is supposed to solve these issues.
How to migrate to Android X

Issue Implementing Admob Ads Dependency

When i try to add admob add dependency which is
implementation 'com.google.android.gms:play-services-ads:17.1.1'
https://imgur.com/XodA9vJ
error details:
All com.android.support libraries must use the exact same version >specification (mixing versions can lead to runtime crashes). Found versions >28.0.0, 26.1.0. Examples include com.android.support:animated-vector->drawable:28.0.0 and com.android.support:support-media-compat:26.1.0 less... >(Ctrl+F1)
Inspection info:There are some combinations of libraries, or tools and >libraries, that are incompatible, or can lead to bugs. One such >incompatibility is compiling with a version of the Android support libraries >that is not the latest version (or in particular, a version lower than your >targetSdkVersion). Issue id: GradleCompatible
tried to change lower appcombat version
//code
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "highproteinfoodsofalltimes.com.highproteinfoods"
minSdkVersion 15
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'
}
}
buildToolsVersion '28.0.3'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
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'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.google.android.gms:play-services-ads:17.1.1'
}
add this 3 lines to your dependency build.gradle
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'

Gradle versions specification: using mancj/MaterialSearchBar with API lvl 27?

I am using mancj/MaterialSearchBar to set up a search bar which looks like the Playstore's one. However, I'm having some trouble with my Gradle build.
The error
build.gradle (Module: app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.."
minSdkVersion 27
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
renderscriptTargetApi 27
renderscriptSupportModeEnabled true
}
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.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.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'
implementation 'com.github.mancj:MaterialSearchBar:0.7.6'
}
Solution tried
I already tried to replace the implementation of this API with the following line: implementation 'com.github.mancj:MaterialSearchBar:0.7.6:27.1.1' but it didn't find it (meaning it doesn't exist).
The library (version 0.7.6) is using 3 dependencies (AppCompat-v7, RecyclerView-v7 and CardView-v7) related to the version 25.4.0.
Because you are already using AppCompat-v7 and RecyclerView (RecyclerView is included into Design), the library is going to use the version 27 instead of 25.
You only have one more library to convert from 25 to 27, CardView-v7.
If to add implementation 'com.android.support:cardview-v7:27.1.1',
this will force the library to use the version 27 instead of 25, and therefor allow you to compile.
You still need to take care by testing your app to see if its behavior is correct, as the library was not tested to use 27 yet.
use latest version
implementation 'com.github.mancj:MaterialSearchBar:0.8.2'
add this code to the the project level build.gradle file
maven { url "https://jitpack.io" }
one can substitute the conflicting version alike this (and hope it will still work with 27.1.1):
implementation "com.android.support:cardview-v7:27.1.1"
implementation ("com.github.mancj:MaterialSearchBar:0.7.6") {
exclude group: "com.android.support", module: "cardview-v7"
}

All com.android.support libraries must use the exact same version specification gradle error

I keep receiving an error: All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 27.1.1, 25.2.0. Examples include com.android.support:animated-vector-drawable:27.1.1 and com.android.support:support-media-compat:25.2.0
This error shows on com.android.support:appcompat-v7:27.1.1 line.
I added Firebase to my app and it shows that these dependencies can be updated to newer versions.
I know about other same questions but appcompat and Firebase versions are different.
Here is the code in app/build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.airliner.chatting"
minSdkVersion 16
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.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
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'
}
apply plugin: 'com.google.gms.google-services'
I solved it by adding
implementation 'com.android.support:support-media-compat:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
Just copy the second library name from the error message, add it to dependencies and change it's version to the same as the first library name.

appcompat-v7:27.1.1 conflicts with play-services:11.0.1

I am working on a new app. Presently I am trying to add dependency.
implementation 'com.google.android.gms:play-services:11.0.1'
When I do I get a gradle compile error on implementation 'com.android.support:appcompat-v7:27.1.1' saying:
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 27.1.1, 26.1.0. Examples include com.android.support:animated-vector-drawable:27.1.1 and com.android.support:mediarouter-v7:26.1.0
Any ideas how to best resolve this issue?
Gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.boulbabazitouni.getdevicelocation_time"
minSdkVersion 21
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(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-vector-drawable:27.1.1'
implementation 'com.android.support:mediarouter-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
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'
implementation 'com.google.android.gms:play-services:11.0.1'
}
The problem is that you have some transient dependencies in this libraries. Whenever this happens you can explicitly add the conflicting dependencies and match them with your current version:
implementation 'com.android.support:animated-vector-drawable:27.1.1'
implementation 'com.android.support:mediarouter-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'

Categories

Resources