Mixing versions can lead to runtime crashes after adding admob ads library - android

I Know there are many question like this, but didn't find any one with Admob ads dependency, i just want to use Admob ads in my app, and i added the ads-dependency from official website implementation 'com.google.android.gms:play-services-ads:15.0.0'.
But shows me this warning:
All gms/firebase libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 15.0.1, 15.0.0. Examples include com.google.android.gms:play-services-ads-identifier:15.0.1 and com.google.android.gms:play-services-ads:15.0.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.)
I only want to use ads dependency only without the firebase.

check your app-gradle file, you have a conflict in dependencies. Update the following
com.google.android.gms:play-services-ads:15.0.1

Related

Crash APP in Android 5 - android.content.res.Resources$NotFoundException

I have the app and in Android 6, 7 everything is ok, but when I can't open an app on android 5. The problem in LOG is:
android.content.res.Resources$NotFoundException: File
res/drawable-v21/ic_apps_selector.xml from drawable resource ID
0x7f08006a
Please help me with this
In gradle i have one warning but i dont know how to fix it:
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0, 27.1.0. Examples include com.android.support:animated-vector-drawable:28.0.0 and com.android.support:exifinterface:27.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
Try adding vectorDrawables.useSupportLibrary = true in your gradle and
static {
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}
to your activity.
See Resources$NotFoundException

Android Studio / com.android.support:appcompat-v7:27.1.1 is underlined in red

When I implement google Admob this line is underlined as wrong:
implementation 'com.android.support:appcompat-v7:27.1.1'
Info: 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:customtabs:26.1.0
All works fine when gradle is without Admob. When I add Admob problem appears:
com.google.android.gms:play-services-ads:17.1.1
I tried to change the same versions of appcompat and customtabs but its not works..
Recent versions of Google Play Services (GMS) libraries are compiled with SDK 28 and depend on support library 28.0.0.
You should raise your compile SDK to 28 and all your support libraries should use version 28.0.0. These are the rules:
Support library major version needs to match compile SDK version.
All suppport libraries must use the same version.
After you make sure your app works in this setup consider migrating to AndroidX. AndroidX replaces support library.

All gms/firebase libraries must use the exact same version specification

All gms/firebase libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 15.0.0, 12.0.1. Examples include com.google.android.gms:play-services-ads:15.0.0 and com.google.android.gms:play-services:12.0.1
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).
android studio is giving me this error. How to solve this error? Here is the image of showing error.
You need to add a resolution strategy in your build.gradle file to tell which version of the library need to be used while building your application. The configuration might look something like this.
configurations.all {
resolutionStrategy {
force 'com.android.support:design:25.3.1'
force 'com.android.support:support-v4:25.3.1'
force 'com.android.support:appcompat-v7:25.3.1'
}
}
Modify as per your requirement of the library version.
As it says itself
Found versions 15.0.0, 12.0.1.
You should use same version for all google gms libraries.
Replace this line
compile 'com.google.android.gms:play-services:12.0.1'
with this
compile 'com.google.android.gms:play-services:15.0.0'
First of all use the whole play service is just wrong unless you really need every single sub-package, but from your screenshot you are already using some sub-package. The use of the whole play service package could means you need multi dex support because you include a lot of not needed methods, Proguard is your friend in this case. So my response is: just remove that line.

Possible effects of mixing dependencies versions

Recently I wanted to update my app's dependencies, as I saw new version of com.android.support:appcompat-v7 library came up (27.0.0). After incrementing this lib version, Android Studio underlines this library and shows a popup with error message:
All com.android.support libraries must use the exact same version
specification (mixing versions can lead to runtime crashes). Found
versions 27.0.0, 25.2.0. Examples include
com.android.support:animated-vector-drawable:27.0.0 and
com.android.support:support-v13:25.2.0
I've run gradlew app:dependencies command and saw other dependency which uses android support lib but it's older version - 25.2.0. My question is: what should I do? I assume I have to downgrade android support lib version as otherwise I may see No Method Found or No Class Found errors, am I right? Is it possible to include both of these versions somehow, that the library causing conflicts will be still able to use older version?
Thanks for help!
As you wrote already, one way is to downgrade to the lowest version. But I think that as long as you are not using that specific methods that the library with older dependency is using, you should be fine. But for the sake of safety, you should have all the dependecies of the same version

I just updated my Android Studio to 2.3.1. I am getting the following error

All com.android.support libraries must use the exact same version
specification (mixing versions can lead to runtime crashes). Found
versions 25.3.0, 25.1.1, 23.4.0. Examples include
com.android.support:animated-vector-drawable:25.3.0 and
com.android.support:cardview-v7:25.1.1 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.)
Go to all the gradle files and make version identical.
It should be having same version across all modules as tagetVersionSDK.
Hopefully This should solve your problem.

Categories

Resources