I'm trying to add firebase-auth:15.0.0 dependency to my project with appcompat-v7:27.0.0 but it causes a warning that "mixing versions can lead to runtime crashes".
I also tried to add new updated dependency of firebase-auth:15.1.0 but it causes the same issue.
Here is my dependencies block
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.google.firebase:firebase-auth:15.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'
}
You cannot upgrade to Version 27.1.0 as long as you are using libraries that run on lower versions. In your case, you simply have to "give in" and go for Version 26.1.0 (the lowest common denominator). You may upgrade to Version 27.1.0 once all libraries have been upgraded to 27.1.0.
Please try
implementation 'com.android.support:appcompat-v7:26.1.0'
Try this
implementation('com.google.android.gms:play-services-ads:15.0.1') {
exclude group: "com.android.support"
}
The error is been fixed here on this video https://youtu.be/Vjy_uv10t30
Or
add this //noinspection GradleCompatible
before
implementation 'com.android.support:appcompat-v7:28.0.0'
and synch.
That's all.
Related
I found a error problem in build.gradle. Have a message to me "All com.android.support libraries must use the exact same version specification (mixing version can lead to runtime crashes). And there is a red line on the bottom of "implementation 'com.android.support:appcompat-v7:28.0.0'".I don't know where I went wrong.
Thank you
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.android.support:appcompat-v7:28.0.0"
implementation "com.android.support:design:28.0.0"
implementation "com.android.support:design:28.0.0"
implementation 'com.android.support:palette-v7:28.0.0'
implementation "com.android.support:cardview-v7:28.0.0"
implementation "com.android.support:recyclerview-v7:28.0.0"
//Firebase Dependencies
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-firestore:18.0.1'
implementation 'com.google.firebase:firebase-database:16.0.6'
implementation 'com.google.firebase:firebase-storage:16.0.5'
implementation 'com.google.firebase:firebase-ads:17.1.3'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-appindexing:17.1.0'
implementation 'com.google.firebase:firebase-ads:17.2.0'
implementation 'com.google.android.gms:play-services-ads:17.2.0'
implementation 'com.artjimlop:altex-image-downloader:0.0.4'
implementation 'com.yalantis:ucrop:2.2.0'
implementation 'com.github.danimahardhika:cafebar:1.3.1'
implementation 'com.github.qiugang:EditTag:v1.2.4-beta2'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.airbnb.android:lottie:2.6.0'
implementation 'com.github.chyrta:AndroidOnboarder:0.7'
//Error Fixer
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:support-vector-drawable:28.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'
Your gradle dependencies require rework:
Clean the duplicate dependencies and add each line only once!
Lines:
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation "com.android.support:design:28.0.0"
are twice. Keep each one only once!
Use only one version definition of each library. Firebase core has import of two different versions:
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.7'
Select one of the two lines.
Depenencies of your dependencies should not have different versions. You have many libraries that use other versions of com.android.support components, which can cause this error.
For example:
'com.artjimlop:altex-image-downloader:0.0.4' use com.android.support:appcompat-v7:23.1.0 see here
'com.yalantis:ucrop:2.2.0' use com.android.support:appcompat-v7:24.2.0 see here
'com.github.danimahardhika:cafebar:1.3.1' use com.android.support:design and com.android.support:cardview-v7 see here
'com.github.qiugang:EditTag:v1.2.4-beta2' use com.android.support:recyclerview-v7 and com.android.support:appcompat-v7 see here
etc the list goes on for almost all 3rd party github libraries.
You can use the following configuration in order to exclude all that dependencies.
configurations {
all*.exclude module: "appcompat-v7"
all*.exclude module: "recyclerview-v7"
all*.exclude module: "design"
all*.exclude module: "cardview-v7"
// ... etc in case there are extra dependencies
}
or even better you can get through each dependency and exclude the exact libraries that cause the duplication:
ie. for 'com.artjimlop:altex-image-downloader:0.0.4' you should change the implementation 'com.artjimlop:altex-image-downloader:0.0.4' with:
implementation ('com.artjimlop:altex-image-downloader:0.0.4') {
exclude group: 'com.android.support', module: 'appcompat-v7'
// for more than one just add it in a new line ie.
// exclude group: '<first part till : symbol>', module: '<second part between : symbol and version>'
}
Read this article here if you want to dig further regarding dependencies of dependencies issue.
You must be seeing red line like this right? hover your mouse pointer on red line and you will see dialog like this. find which libraries are still old (in my case it was cardview) add that library's latest version in gradle and your issue may be solved.
If still it doesn't then I am seeing that you are using old Firebase libraries, update them to latest too.
The error message is pretty clear, "All com.android.support libraries must use the exact same version specification". For example, you have this:
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.7'
You are trying to build 2 different versions, 16.0.1 and 16.0.7, of the same library. This can lead to runtime crashes. Choose which version you want to keep and delete the other. For example, if you want the version 16.0.7, replace these two lines with:
implementation 'com.google.firebase:firebase-core:16.0.7'
I was trying to upgrade my android compile and target version to 27 . But the dependencies always had issue . Currently the added dependencies looks like this but still some problem persists .
the dependencies in my gradle file looks like this.
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.google.android.gms:play-services-ads:17.1.3'
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'
implementation 'org.jsoup:jsoup:1.10.3'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation'com.google.firebase:firebase-config:16.1.0'
I tried modifying the gradle dependencies but that isnt helping.
I want to upgrade the app gradle to version 27 but then still the problem persists.
Please help!
When add firebase in
dependencies
implementation 'com.google.firebase:firebase-core:16.0.6'
Or
implementation 'com.google.firebase:firebase-ads:17.1.2'
Or
implementation 'com.google.android.gms:play-services-ads:17.1.1
It shows error under implementation 'com.android.support:appcompat-v7:28.0.0' that All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes).
When I sync the app no error but when install the app it shows you app has been stopped (Crashing during run time).
When remove the firebase dependencies and run, my app it's working fine.
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
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.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.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'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-ads:17.1.2'
implementation 'com.google.android.gms:play-services-ads:17.1.1'
}
apply plugin: 'com.google.gms.google-services'
When you include dependencies, they too, will sometimes include dependencies of their own. Some of the firebase libraries happen to include support libraries at a lower version than 28. When you hover over the error message for appcompat-v7 it should tell you what library is lower than 28. You may have to click 'show more' on the error message. Once you figure out which one it is, include that exact same library but version 28. Resync your gradle and you're good to go. Also, you might have to do this multiple times because some firebase libraries include multiple lower version support libraries and the error message will only show you one library at a time.
I have following dependencies in my app-level build.gradle file
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:27.1.1'
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'
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.github.bumptech.glide:glide:4.8.0'
implementation 'com.android.support:cardview-v7:27.0.2'
}
These works fine without any error. But, When I try to put a new third party dependency of CircleImageView implementation 'de.hdodenhof:circleimageview:2.2.0', the gradle build fails and there is error on implementation 'com.android.support:appcompat-v7:27.0.2' line saying All com.android.support libraries must use the exact same version.... I am wondering how this third party library creating problem in support libraries. What is wrong there?
That library is implementing support libraries as well, but different versions. Specifically, it uses the support-annotations 27.1.0 library.
There are two things you can do.
Update your dependencies. 27.0.2 is outdated. 27.1.0 is as well, but less so.
Exclude that library from your implementation and implement it yourself:
implementation ("de.hdodenhof:circleimageview:2.2.0") {
exclude group: "com.android.support" module: "support-annotations"
}
implementation 'com.android.support:support-annotations:27.1.1'
You should update all your support dependencies to 27.1.1.
The third party library internally uses the app compat library and because the version used by project is different from the library version, it gives the error. Updating appcompat, design and cardview dependencies to version 27.1.1 worked fine as follows.
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:27.1.1'
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'
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.github.bumptech.glide:glide:4.8.0'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'de.hdodenhof:circleimageview:2.2.0'
}
If you want all support libraries including third party libraries internally use the same support library version, then add below code in your project level gradle
ext {
support_library_version = '27.1.1'
}
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex')) {
details.useVersion "$support_library_version"
}
}
}
}
The support libraries should have the same version as the other dependencies which are related.
Change them to v 27.1.1 (The point is they should have the same version):
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
And then if you saw any errors which points to "should have same version", run :
./gradlew dependencies
To see which library is using old version.
Mostly, it can be fixed by adding the updated version of the library (same as the support library) in your build.gradle dependencies.
I am trying to build Microsoft Sharepoint client for Lists. In order to do that I am using Office365 Services library and API. My gradle dependencies look like below:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
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'
api 'com.microsoft.aad:adal:2.0.4-alpha'
api 'com.microsoft.services:sharepoint-services:1.0.0#aar'
api 'com.microsoft.services.orc:orc-android:1.3.1'
api 'com.google.guava:guava:25.1-android'
}
During gradle synch it fails with error:
error: resource android:attr/fontVariationSettings not found.
Message{kind=ERROR, text=error: resource android:attr/fontVariationSettings not found., sources=[C:\Users\rahul.deshmukh\.gradle\caches\transforms-1\files-
1.1\appcompat-v7-27.1.1.aar\014d6f324620f9879a964fbd74e0b4be\res\values\values.xml:251:5-69],
original message=, tool name=Optional.of(AAPT)}
Gradle file shows mouse over error for :
implementation 'com.android.support:appcompat-v7:27.1.1'
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes).<br> Found versions 28.0.0-alpha1, 27.1.1. Examples include com.android.support:asynclayoutinflater:28.0.0-alpha1 and com.android.support:animated-vector-drawable:27.1.1 more... (Ctrl+F1)
Not sure which library is conflicting with which one. Any help would be greatly appreciated.
Thank you.
One of your dependencies is using resources that were only added in API 28 (P). Either find the library and use an older version, or update your compile SDK version to 'android P preview' (you can download it using the SDK manager).
I had to change implementation order and also reduce versions of some of the dependencies as suggested by Izabela Orlowska in her answer.
Here are how my dependencies looks like now:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
api 'com.google.guava:guava:25.1-android'
api 'com.microsoft.aad:adal:1.14.0'
api 'com.microsoft.services:sharepoint-services:1.0.0#aar'
api 'com.microsoft.services:odata-engine-core:0.11.1'
api 'com.microsoft.services:odata-engine-android-impl:0.11.1#aar'
api 'com.microsoft.services.orc:orc-android:1.3.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.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'
}
I am off this hurdle now. Thank you all who commented and suggested.