I receive this warning:
All com.android.support libraries must use the exact same version
specification (mixing versions can lead to runtime crashes). Found
versions 27.1.1, 27.1.0. Examples include
com.android.support:animated-vector-drawable:27.1.1 and
com.android.support:exifinterface:27.1.
I understand this, but why is this warning shown to me even though all the com.android.support versions are the same? (27.1.1)
this is the content of my file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.app.sin.retrolist"
minSdkVersion 18
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:recyclerview-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.jakewharton:butterknife:8.8.1'
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.squareup.picasso:picasso:2.71828' }
To see why a specific dependency is included in your dependency tree, you can (assuming that your main module is named app and you are on macOS) run a simple:
./gradlew app:dependencies
In the console output, you will see the full dependency tree and how library versions are resolved.
The proper way to deal with dependencies conflicts like this is to explicity define a resolution strategy:
configurations.all {
resolutionStrategy {
force 'com.android.support:exifinterface:27.1.1'
}
}
This must be placed in the root of your build.gradle file in the app module.
Overriding the conflicting dependency with:
dependencies {
...
implementation 'com.android.support:exifinterface:27.1.1'
}
is less correct, as your module doesn't directly depends on this library so, if for example future versions of your dependencies won't depend on it anymore, it will still be included in the list of resolved dependencies even if you don't need it.
Even better, you could define:
ext {
supportLibVersion = "27.1.1"
}
in your main build.gradle file, and then use it wherever you need it:
configurations.all {
resolutionStrategy {
force "com.android.support:exifinterface:$rootProject.supportLibVersion"
}
}
dependencies {
...
implementation "com.android.support:appcompat-v7:$rootProject.supportLibVersion"
implementation "com.android.support:recyclerview-v7:$rootProject.supportLibVersion"
implementation "com.android.support:cardview-v7:$rootProject.supportLibVersion"
...
}
Related
I need to use LifecycleObserver in my app (already existing one).
This's my build.gradle (app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "it.tux.app"
minSdkVersion 24
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'android.arch.lifecycle:extensions:1.1.1'
implementation 'com.android.support:preference-v7:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation "com.android.support:support-core-utils:27.1.1"
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:support-v13:27.1.1'
implementation 'io.github.controlwear:virtualjoystick:1.9.2'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.jjoe64:graphview:4.2.2'
testImplementation 'junit:junit:4.12'
}
Of course I put also:
allprojects {
repositories {
google()
jcenter()
maven { url 'https://maven.google.com' }
}
}
in project build.gradle.
After gradle sync I got an error about incompatibility between com.android.support:preference-v7:27.1.1 and androidx.* dependencies.
If I try to compile things get worse. How can I fix this?
Seems like you have mixed up both support library and androidX.
Migrate everything to androidX. Follow this official guide
1. With Android Studio 3.2 and higher, you can migrate an existing project to AndroidX by selecting Refactor > Migrate to AndroidX from the menu bar.
2. In your gradle.properties file, add these lines:
android.useAndroidX=true
android.enableJetifier=true
Also take a look at this answer for details.
I want to add fcm to my android project. Following the guide, I added firebase to my app and inserted the dependency. But now I get the error
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
on the appcompat dependency(or maybe I just haven't noticed it before)
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "myApp.ginso.com.azul"
minSdkVersion 26
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(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
Can anyone tell me, what I have to change?
Issue is that espresso-core is using older dependency of support library group. Increase it to latest version (3.0.2 or whatever latest is) or use below code instead of your existing code to explicitly remove support group from it:
androidTestImplementation ('com.android.support.test.espresso:espresso-core:3.0.1') {
exclude group: "com.android.support"
}
Hope this will solve your problem.
Some of your libraries have used an older version of dependencies.
To resolve this add this dependency and try again
implementation 'com.android.support:support-media-compat:28.0.0'
This is error *** 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)
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).
this is error line on gradle dependancy =
implementation 'com.android.support:appcompat-v7:28.0.0'
this is my gradle (app)
enter image description here
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.thiyo.sdddddddddddddddddddd"
minSdkVersion 19
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(dir: 'libs', include: ['*.jar'])
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.google.firebase:firebase-core:16.0.1'
}
apply plugin: 'com.google.gms.google-services'
I found answer thanks all helpers :-)
to resolve i just added these line gradle dependencies block
like this
>
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
add the following code to gradlebuild project not gradle app and it will solve your problem add it at the end .
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "26.1.0"
}
}
}
}
Try This from Menu File-> Invalidate Caches and Restart -> Invalidate and Restart
If this doesn't work, delete .idea file(from root directory of project), Build -> Clean Project then Build -> Rebuild Project
Try using both appcompat & support and then add other implementations
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.shery.youtubevideodownloader"
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(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.android.gms:play-services-ads:17.0.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'
}
i want to add admob ads on my app i have added dependencies you can check above and i have add maven on the gradle but why this error comes
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
}
but my error comes on this line below
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
and the error is
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, 26.1.0. Examples include com.android.support:animated-vector-drawable:28.0.0-alpha1 and com.android.support:customtabs:26.1.0 less... (Ctrl+F1)
why this error comes i dont know
customtabs libs is using the version of support library 26.1.0 which is less than 28.0.0-alpa1.
All your libraries should be using the same version of the support libraries either 28.0.0-alpha1 or 26.1.0. Can you change
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
to implementation 'com.android.support:appcompat-v7:26.1.0
Hello I am having a problem with my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.dell"
minSdkVersion 19
targetSdkVersion 26
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:design:26.1.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-firestore:12.0.1'
implementation 'com.firebaseui:firebase-ui-firestore:3.3.0'
implementation 'hanks.xyz:htextview-library:0.1.5'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
Android Studio gives me this warning:
All com.android.support libraries must use the exact same version
specification (mixing versions can lead to runtime crashes). Found
versions 27.1.0, 26.1.0. Examples include
com.android.support:recyclerview-v7:27.1.0 and
com.android.support:animated-vector-drawable:26.1.0
Can somebody please help me? I don't know what to do. I tried even making it v 27. I even deleted it, but it still didn't solve my problem.
I am also seeing this error:
Error:Execution failed for task
':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge
dex
Android Studio warning
All com.android.support libraries must use the exact same version
specification (mixing versions can lead to runtime crashes). Found
versions 27.1.0, 26.1.0. Examples include
com.android.support:recyclerview-v7:27.1.0 and
com.android.support:animated-vector-drawable:26.1.0
Problem
One of your dependencies (com.firebaseui:firebase-ui-firestore:3.3.0) has a transitive dependency on com.android.support:recyclerview-v7:27.1.0. Meanwhile, the support libraries that you manually declare in your build file use version 26.1.0.
Solution
Update compileSdkVersion and targetSdkVersion to 27 and your support libraries to 27.1.1
android {
compileSdkVersion 27
defaultConfig {
targetSdkVersion 27
...
}
...
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
...
}
Tip (optional)
Since com.android.support:design has transitive dependencies on com.android.support:appcompat-v7 and com.android.support:support-v4, you do not have to manually declare the appcompat-v7 or support-v4 dependencies if you declare the design dependency.