Error in appcompat version during gradle - android

I am getting below error
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 26.0.0-alpha1, 25.2.0. Examples include com.android.support:animated-vector-drawable:26.0.0-alpha1 and com.android.support:mediarouter-v7:25.2.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.)
for line 27, I am novice in android & trying to use google play service and map
I have updated manifest file with but after I move to build.gradle it is showing this error

I have tried replicating your case and found that
compile 'com.google.android.gms:play-services:11.0.4'
internally uses android appcompat version 25.2.0
and hence to remove this error, just change your code from:
compile 'com.android.support:appcompat-v7:26.+'
TO
compile 'com.android.support:appcompat-v7:25.2.0'
Also, if your compileSdkVersion is 26, it will give warning so just change it to 25 and all your errors/warnings will be resolved(No red lines in build.gradle)
Hope it helps!

If your targetSdkVersion is 26 means
The appcompat library should be like below
compile 'com.android.support:appcompat-v7:26.1.0'

Related

Which com.google.android.gms:play-services-ads version is compatible with com.android.support:appcompat-v7:27.1.1?

No duplicate:
In my question I've already linked an answer similar to the supposed duplicate and explained, why I'm not looking for such an answer.
Android Studio 3.2.1 automatically included
implementation 'com.android.support:appcompat-v7:27.1.1'
for my new app. I manually included
implementation 'com.google.android.gms:play-services-ads:17.1.1'
following the official guide.
The official guide from google seems to be outdated, as Android Studio immediately suggests using version 17.1.3 instead.
In both cases however there is a red line under appcompat-v7 and a tooltip warning me that:
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.
I do get the general problem here, play-services-ads transitively depends on an old version of some support library. This answer suggests to simply include the offending libraries manually in the correct version.
However, I don't like this solution for two reasons:
I simply don't want to deal with problems like this. There should be compatible versions available for the google libraries.
At some point in the future I might have forgotten why I included all these libraries I don't even know what they do. I might want to update the appcompat and play-services-ads dependencies without thinking about all this again.
Is version 17.1.3 the most recent version of play-services-ads as of now? Does that mean that play-services-ads is generally lagging behind? If so, I would prefer to downgrade appcompat-v7 instead of including some library versions manually.
What would be the correct version of appcomat-v7 for play-services-ads version 17.1.3? Or maybe more generally asked: Which are the most recent versions of appcompat-v7 and play-services-ads that work together hassle free?
26.1.0 is the correct appcompat-v7 version for play-services-ads 17.1.*
implementation 'com.android.support:appcompat-v7:26.1.0'
This also requires compileSdkVersion and targetSdkVersion to be set to 26.

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.

Gradle error while adding dependencies

I want to add a card view so that I want to add dependencies (got from google search) when the time of adding dependencies
compile 'com.android.support:cardview-v7:21.0.+'
I am getting gradle error saying that
This support library should not use a different version (21) than the compileSdkVersion (23) 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.)
Change your CardView dependency to:
compile 'com.android.support:cardview-v7:23.1.1'
You cannot have a different compile SDK version to versions of the support library.
You used sdk version 23 for your project, but you use version 21 for cardview. If you compile with cardview-v7:23 there should not be a problem any more. It is also a good idea to update the support libraries, if this does not help.
Edit: As I see the picture you posted, you can see that you use 23.1.1 for the other dependencies, but 21.0.+ for the others. Change 21.0.+ to 23.1.1
compile 'com.android.support:cardview-v7:23.0.1'

Categories

Resources