Android Firebase and google service latest version conflicts - android

I am use the latest version for individual dependencies.
Versions are referenced from here and here
But I am still getting warning message of conflict versions.
Not sure if it is safe to use like this.
Images attached below.

you can update same version all play services dependencies and solve the issues

Also try to remove your custom libraries from project and sync project. Old versrions of libraries can be used by them.

Related

How to know if there's a dependency update using Gradle Version Catalog

My project is using now Version Catalog for all the Gradle modules, and now using the type safe declaration of dependencies in the build.gradle file I don't get any suggestions from the IDE when there's an update of a specific dependency.
What would be the best approach to know if there's an update of a dependency, instead of checking manually one by one?
My recommendation is to use the gradle-versions-plugin or this extension of it (https://plugins.gradle.org/plugin/se.ascp.gradle.gradle-versions-filter). Both add an additional gradle task dependencyUpdates to your project that will tell you which version updates are available.
Also works fine in combination with the new versions catalog feature you mentioned. I am using it too.

Which library should I use for Location when using google maps?

I have the following library for the google maps and it works fine
implementation 'com.google.android.gms:play-services-maps:16.1.0'
But when I try to add this one for location,
implementation 'com.google.android.gms:play-services-location:16.1.0'
the following error occurs
Failed to resolve: com.google.android.gms:play-services-location:16.1.0
Which library for the location should I use?
THANK YOU.
You will get latest gradle dependencies here
https://developers.google.com/android/guides/setup
It is probably because 16.1.0 does not exist for this library. Google Play Services libraries do not always have the same version. So maps might be on 16.1.0 but location might not even have this version.
To get the latest versions, check the official release page: https://developers.google.com/android/guides/releases
And as you are just starting, make sure to use the latest ones:
com.google.android.gms:play-services-location:17.0.0
com.google.android.gms:play-services-maps:17.0.0
Yes, it is a coincident that those versions are currently the same. As you can see in the list there are already libraries on 19.0.0, like appindexing
com.google.firebase:firebase-appindexing:19.0.0
Edit
A small practical tip: If you replace the version by + and sync the project, gradle will get the newest one and afterwards you can use the IDE warning to replace the + again with the newest version number. That eases a bit the checking on different pages if there is a new version or not etc

there is something wrong with my appcompat version

I don't really understand why my appcompat version is not accepted
Please help
click to see image
This is a warning, your app will still run.
One or more of your transitive dependencies is requesting different version of of the Android Support Library that you are not requesting directly yourself, resulting in this conflict. You will need to run a Gradle dependency report and find out what is causing the problem, then manually request those artifacts yourself with your desired version (presently, 27.0.1).
I think in your case facebook is using old version, you should try updating facebook dependency version to latest.
You can see this answer as well.
You have probabelly some libraries that use older versions of some others support libraries (not especially AppCompat), so you have to override them manually in the gradle to get rid of this warning.
You have to repeat this until the warning disapear :
When you see the hint, copy and past the library and update the version number : for example if in the hint you have
"blablabla... example include blablabla...
com.android.support:support-core-ui:26.0.1"
Add this to the dependencies section of the build.gradle script :
implementation 'com.android.support:support-core-ui:27.1.1'

How does Gradle choose between more than 1 versions of the same library in a gradle tree?

Let say I have added Facebook and Twitter dependencies in my app.
com.facebook.android:facebook-android-sdk:4.22.1
com.twitter.sdk.android:twitter:2.1.0
When i look at Gradle tree, They come up with bunch of other transitive dependencies.
Now If Facebook uses com.android.support:support-annotations:24.1.1 and twitter uses com.android.support:support-annotations:25.0.3
Then which version gradle will use.
In gradle tree, It shows -> in front of older version of dependency. I learnt that this means gradle will use the newer version, and will not use the older version.
But this can be a problem, because some libraries are meant to run on the specific versions, and i have faced this problem.
In one of article i found out how npm manages these dependencies conflicts, but i am still unsure how gradle will manage between different version of same library.
You can't have different versions of the same library inside an apk.
As you mentioned, by default, Gradle puts the newest one to the build. If you want to specify a concrete version of the library that should be used in your project, you can add a direct compile (or implementation / api for Android Gradle Plugin v3+) statement with a required version to get one.
Also, you can force version using a special syntax, but it can lead to some problems later. You can find more information about version conflicts resolution in this post

Android Gradle Dependencies conflict with com.android.support:appcompat-v7

Basically I have Android app which uses 23.1.1 of the support library(com.android.support:appcompat-v7:) while Im using a library which uses 25.0.0 version. Basically if I update the version and make it to be equal(the project one and the library one) Im getting a lot of null pointer exceptions which is pretty strange because the app works pretty well at the current version(23.1.1). If I force the library to be using the version of the app - there is a compile error because a new things have been added with the new version(25.0.0). Is it possible somehow to say in the build.gradle let`s the app be using the 23.1.1 version of com.android.support:appcompat-v7: and the library to use its(25.0.0) version of com.android.support:appcompat-v7:?
Is it possible somehow to say in the build.gradle let`s the app be using the 23.1.1 version of com.android.support:appcompat-v7: and the library to use its(25.0.0) version of com.android.support:appcompat-v7:?
No, because there is only copy of appcompat-v7 in your app.
Can you try to remove your import of the 23.x.x of the support library .
The version of the support library that is present in your lib will be use .

Categories

Resources