Gradle error while adding dependencies - android

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'

Related

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.

Error in appcompat version during gradle

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'

appcompat version and declaration issue

i try to migrate minSDK from 9 to 14 (that's newest play_services minimum). Target SDK is 17. When i change it manually in gradle and manifest after sync, a huge list of problems showing up. Most of them has something in common with appcompact.
E:\Android\Android\android studio projects\Sklepik\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\24.0.0\res\values-v23\values-v23.xml
I think that these problems are because wrong version is in use (project works good few months ago), but i can't find place of declaration appcompact.
Right now i've got 2 dependiences in gradle:
dependencies {
compile 'com.android.support:support-v4:19.1.0'
compile 'com.google.android.gms:play-services:10.2.0'
}
How to solve it?
---> Keyur, after change support version i have problem which looks like:
of course my internet connection is ok...
Add support v7 library
compile 'com.android.support:support-v7:19.1.0'

The latest support library v4 requires minSdk(API 20, L Preview)?

I'm trying to run a project with the Android Studio 0.8.0 beta and the latest tools, it requires API 20, so it fails to run on the device with API 19
Any ideas?
If you configured your gradle settings to compile the latest version of
'com.android.support:support-v4:+'
'com.android.support:appcompat-v7:+'
then the RC will be downloaded, which requires the L - Preview.
See the Answers here.
Use
'com.android.support:support-v4:20.+'
'com.android.support:appcompat-v7:20.+'
everywhere in your project instead.
The problem still arises with transitive dependencies. Gradle offers a way to force the usage of a specific version of a dependency.
For example you can add something like:
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:20.+'
force 'com.android.support:appcompat-v7:20.+'
}
}
to your build.gradle.
If you want to learn more about gradle resolution strategies refer to this guide http://www.gradle.org/docs/current/dsl/org.gradle.api.artifacts.ResolutionStrategy.html
I found this while reading the corresponding issue which I will link here

Categories

Resources