I'm fairly new to Android development, so apologies if this is obvious. I've searched quite a lot but am unable to resolve my issue.
In my build.gradle file I have the following section:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:design:26.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.firebase:firebase-auth:15.1.0'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.wdullaer:materialdatetimepicker:3.2.2'
}
However the line implementation 'com.android.support:appcompat-v7:26.1.0' is showing with a red squiggly line underneath and displaying the following message:
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 26.1.0, 25.3.1. Examples include com.android.support:animated-vector-drawable:26.1.0 and com.android.support:support-v13:25.3.1 less... (โ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).
I am unable to find out how to solve this issue. Building the project works fine and does not report any errors. I've tried doing File > Invalidate Caches / Restart but to no avail.
After doing a bit of searching I read that I can add implementation 'com.android.support:support-v4:26.1.0' to the build.gradle file and it should fix it, however the same error shows even after syncing.
This is an old project I made sometime last year and it doesn't have a lot in it, but I thought it would be better to learn how to resolve this issue rather than just creating a new project to get around it.
Try adding
implementation 'com.android.support:support-v13:26.1.0'
Although in your question, error is explaining everything, com.android.support:animated-vector-drawable:26.1.0 and com.android.support:support-v13:25.3.1 are not having same version.
Should always keep support libraries version same in build.grdale.
implementation "com.android.support:appcompat-v7:$support_lib_version"
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation "com.android.support:design:$support_lib_version"
implementation "com.android.support:support-v4:$support_lib_version"
implementation "com.android.support:cardview-v7:$support_lib_version"
implementation "com.android.support:recyclerview-v7:$support_lib_version"
where support_lib_version is a constant.
ext { support_lib_version = '26.1.0'}
in same build.gradle file out side 'android' and 'dependencies'.
Related
I'm try to use this button style this link But I had Implementation error, my build.gradle like that:
That's my dependencies :
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-database:16.1.0'
implementation 'com.google.firebase:firebase-storage:16.1.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.android.volley:volley:1.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test๐1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
And the error:
ERROR: Manifest merger failed : Attribute application#appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.0.1] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml:5:5-19:19 to override.
How can I fix that?
I guess this error is happening because their latest version is using AndroidX but your app is still using Support Library.
So, I guess there are two possibilities:
Downgrade library version
Checking their release history, it seems the AndroidX was introduced on version v2.0.0. So, use an old version: v.1.14.0. Just use implementation 'br.com.simplepass:loading-button-android:1.14.0'
Migrate to AndroidX.
You may also consider to migrate to Android X since Android Support library is now deprecated. For any case, you may want to check first solution to ensure the problem is really being caused by the AndroidSupport/AndroidX conflict
Edit
Just sharing more info since you are not aware about the AndroidX.
When developing an Android App, you probably want to build a single APK which works in different Android Versions. However, as you may imagine, there are some differences between different Android versions such as methods that are no longer used (deprecated) or were added later etc. Features that exists in a version but not in others etc.
For this reason, you will end up using the Android Support Library.
It is a special library which helps you to support several Android versions. Not only that, but some views such as ConstraintLayout, RecyclerView and CardView were released as a library.. as part of the Android Support Library.
In your build gradle, we can see that you are already using the Android Support Library:
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
However, on last year, Android deprecated the Support Library and created the AndroidX. In a certain way, it is the same thing.. Just a different name..
Sooner or later, you will migrate your app to Android X since support library won't be updated anymore.
However, not only you app will migrate to AndroidX but some third party library will move to AndroidX as well. In this case, we have the library LoadingButtonAndroid that started to used the android X in version v.2.0.0. However, since you didn't migrate your app yet, you have some this kind of conflit. So, you fix by either using an old version of LoadingButtonAndroid or by migrating your app to AndroidX.
HERE you can find how to migrate your app to AndroidX. Usually, it is a very simple process. However, Android Studio always forget to change some import and you have to manually change from support library to androidx.
Automatically or manually, migrating to AndroidX just means that you have to update your imports from android.support.v7.app.AppCompatActivity to androidx.appcompat.app.AppCompatActivity
As you can see, class name is the same and there's no code changes... All the views are the same.. Just their package (import) that is different.
Having continuous problems with my gradle. The
implementation 'com.android.support:appcompat-v7:28.0.0'
is underlined in red
This is stopping me from continuing in my development (i'm still very new to android). My problem initially started with
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
being underline in red and causing an error, but changing my import to
import androidx.fragment.app.FragmentActivity;
cured the problem, but my gradle still is having build problems. I have android 3.4, and my gradle wrapper is 5.1.1. I have no idea how to stop the error from occurring and getting rid of my gradle errors.
I've changed it to alpha1, rc01 and tried downgrading the version but its not working.
The dependencies is where my problem is occuring:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.google.android.material:material:1.1.0-alpha7'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.android.gms:play-services-maps: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 just want the gradle to full work and be able to move on haha, I've been trying to fix this for a while...
You are still using older support libraries hence the errors persist even in the app level Gradle file. Add these to your Gradle:
implementation 'com.google.android.material:material:1.0.0-rc01'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
After replacing these with your current implementations in your Gradle, sync the project. After that, clean/rebuild the cache.
Now the code you have wrote is most likely going to give error because the code was using older support library which is no longer in your project. To solve it, you need to rewrite the error code but this time using androidx imports.
You need to refactor your project to androidx
Go to Refactor -> Migrate to androidx
Click on Migrate
My android Studio shows this 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, 26.1.0. Examples include
com.android.support:animated-vector-drawable:27.1.1 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).
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-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.firebase:firebase-core:15.0.0'
Instead of downgrading or excluding the support library, you can solve the problem by overriding the support library. You can override the support library by adding the dependency which is in the error:
implementation "com.android.support:animated-vector-drawable:27.1.1"
For argumentation about this answer, you can see the following issues in Firebase:
Support Library out of date
com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/auth/api/signin/internal/zzf;
It themes like com.google.firebase:firebase-core:15.0.0 depends on older support library varsion (26.1.0).
There already is 15.0.2 version released, so you could try to:
use 15.0.2 version of firebase core. Probably it is based on latest support lib
ignore this message, as it is a warning, not an error, and probably your app would work fine with it. (not recommended, but could work)
downgrade your used support libs version to 26.1.0 so they are the same version. At least until google releases firebase based on the latest support lib version. (recommended way if #1 didn't work)
When you run ./gradlew :app:dependencies, you come to know the transitive dependencies of libraries one has included in their gradle.
From that hierarchy view, one can find out which libraries are depending on older versions and exclude them in gradle as shown below:
exclude group:'com.android.support'//as an example support library is excluded
As far as this question is concerned, it can be done like this:
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-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.firebase:firebase-core:15.0.2'){
exclude group:'com.android.support'
}
Here support library is excluded as firebase core was depending on older versions, creating a conflict.
NOTE:
If your dependencies don't include the libraries that you have excluded but the dependency from which you have excluded needs it, you can add the excluded library in gradle with your compatible version.
Have recently upgraded to Android Studio 3.1, and at the same time I'm trying the Android P preview.
I'm getting the following error on compiling:
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: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).
But I cannot see any instance of 26.1.0 anywhere. All I have in my gradle is:
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support:design:28.0.0-alpha1'
I've tried clearing caches, rebuilding app, etc. But error remains.
You need to override the conflicted libraries by adding the conflicted libraries to your dependencies block
dependencies {
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'
The above warning is not specific to media-compat dependency. They just added example to explain the issue. The issue get resolved by adding v4 lib for me.
implementation 'com.android.support:support-v4:28.0.0'
in addition to
implementation 'com.android.support:appcompat-v7:28.0.0'
No need include
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
You need to override the conflicted libraries by adding the conflicted libraries to your dependencies block. For example, from your error log you'll find the following:
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:support-media-compat:26.1.0 less...
You can remove the error by adding the libraries with something like this:
dependencies {
implementation 'com.android.support:animated-vector-drawable:28.0.0-alpha1`
implementation 'com.android.support:support-media-compat:28.0.0-alpha1`
}
this error came,when i connect app to firebase.
no need to add any thing.
just put mouse cursor on error line(below one) and press Alt+Enter
(implementation 'com.android.support:appcompat-v7:28.0.0')
in the list enter first option.(noinspection)
After that it looks like this,
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
Some dependency โ perhaps playLicensing โ has a transitive dependency on at least support-media-compat, for version 26.1.0.
To work around this:
Identify each Support Library artifact that shows up in "External Libraries" that is older than 28.0.0-alpha1. Based on the error, those older ones should all be 26.1.0, and it will be at least support-media-compat.
For each of those, add your own implementation line to your dependencies, requesting that artifact, but for 28.0.0-alpha1. This will cause Gradle to use the newer artifact, which happens to be what you want.
Hope that whatever is depending on those older artifacts will survive with the newer artifacts.
So, at minimum, you are adding:
implementation 'com.android.support:support-media-compat:28.0.0-alpha1'
In my case I resolved it by adding this below the error line.
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
add in dependencies of build.grad (Module.app)
dependencies {
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
}
In my case adding support-v4 helped me to got loose of warning.
dependencies {
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
// other dependencies
}
Are you using a firebase in your project?
Using firebase core or firebase app indexing seem to be causing the problem.
I was having the same problem, but commenting on firebase packages makes the error to go away
// implementation 'com.google.firebase:firebase-core:16.0.8'
// implementation 'com.google.firebase:firebase-ads:17.2.0'
// implementation 'com.google.firebase:firebase-appindexing:17.1.0'
I think your gradle file has the below dependency. Add this to your app level build.gradle.
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support:mediarouter-v7:28.0.0-alpha1'
implementation 'com.android.support:support-vector-drawable:28.0.0-alpha1'
implementation 'com.android.support:support-v4:28.0.0-alpha1'
I have seen this issue talked about on the FirebaseUI documentation but for the life of me I cannot understand the solution. I want to use the latest version of Firebase Auth and Firestore, as well as the latest version of FirebaseUI. Is this possible? Please do not just link me to the documentation of dependency issue, I would really appreciate an explanation of the documentation and what to actually write on my dependencies to fix this issue. I am tempted to just write my own UI, but firebaseUI is too good to pass up. Here are my dependencies right now:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-firestore:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:26.1.0'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.firebaseui:firebase-ui-auth:3.1.2'
}
With my past attempts at a fix I just tried lowering the versions of firebase..but that's not the solution I'm looking for and it usually just results in other errors. Thank you so much in advance!
EDIT: Here is error message: all gms/firebase libraries must use the exact same version specification(mixing versions can lead to runtime crashes). Found versions 11.8.0,11.6.2.
Examples include com.google.android.gms:play0services-base:11.8.0 and com.google.android.gms:play-services-auth:11.6.2.
{This error is, presumably, happening because firebaseui 3.1.2 is dependent on Firebase 11.6.2. But the version I am trying to use is 11.8.0}
You can exclude a dependencies' dependency with the exclude keyword.
implementation('com.firebaseui:firebase-ui-auth:3.1.2') {
exclude group: 'com.google.android.gms'
exclude group: 'com.google.firebase'
}
Firebase SDK Version 11.8.0 released December 18, 2017, and there is no officially released FirebaseUI version for that release for now. You can see the corresponding versions of Firebase UI - Firebase Services at https://github.com/firebase/FirebaseUI-Android
Corresponding FirebaseUI Version and Firebase/Play Services Versions are listed as:
3.1.2 --- 11.6.2
3.1.0 --- 11.4.2
3.0.0 --- 11.4.2
2.4.0 --- 11.4.0
...
This is why you get an error like :
all gms/firebase libraries must use the exact same version specification(mixing versions can lead to runtime crashes). Found versions 11.8.0,11.6.2. Examples include com.google.android.gms:play0services-base:11.8.0 and com.google.android.gms:play-services-auth:11.6.2.
Check if your
compile 'com.android.support:appcompat-v7:**26**.1.0'
version is same as your
targetSdkVersion **26**
Mine was different and changing this resolved the problem.