I'm using a compatibility library for material card view and the dependency line is giving me error saying that : This support library should not use a different version (21) than the compileSdkVersion(22). The support library is com.android.support:cardview-v7:21.0.0
You are compiling with the SDK version 22 but the CardView dependency specifies SDK version 21.
You have two options:
1. Change CompileSdkVersion in build.gradle to 21
2. Change library version to com.android.support:cardview-v7:22.0.0
Related
I am getting some issue while updating compilesdk and targetsdk to 33.
And if I set compilesdk or targetsdk to 32, 31 or less, I get another library support issue during compilation, as described below...
1. Dependency 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.0-alpha02' requires libraries and applications that
depend on it to compile against version 33 or later of the
Android APIs.
:app is currently compiled against android-32.
Also, the maximum recommended compile SDK version for Android Gradle
plugin 7.2.1 is 32.
Recommended action: Update this project's version of the Android Gradle
plugin to one that supports 33, then update this project to use
compileSdkVerion of at least 33.
Note that updating a library or application's compileSdkVersion (which
allows newer APIs to be used) can be done separately from updating
targetSdkVersion (which opts the app in to new runtime behavior) and
minSdkVersion (which determines which devices the app can be installed
on).
and getting this same issue with all newly added library to the gradle
I'm not sure if this is a sdk 33 or library issue.
I already tried this--->https://stackoverflow.com/questions/30684613/android-studio-xml-editor-autocomplete-not-working-with-support-libraries/54007742#54007742
Please Refer this link. There is issue in Android Studio Chipmunk Version. Google Team fixed in Android Studio Dolphin. Check Issue Tracker as well
Replace
def lifecycle_version = "2.6.0-alpha02"
with
def lifecycle_version = "2.4.0-rc01"
in build.gradle(app) file.
Please refer to this link for screenshot.
I want to use a GraphView in my app, and so I added implementation 'com.jjoe64:graphview:4.2.2' to my app-level gradle.build file.
However that causes an error stating that all com.android.support libraries should have the same version.
It gives com.android.support:support-compat:27.1.1 as an example (all of the libraries I explicitly use are 26.1.0).
I suppose it's a dependency of the GraphView library, but I don't know what to do next.
My target SDK version is 26 so I can't change all the other versions to 27. What can I do to use this library?
Follow below step:
1>If compileSdkVersion is 27 You have to change to 27
enter image description here
2>If you still caught error uninstall and install SDK Target version from SDK Manager.
Currently I am using target 19 (Android 4.4) and i have attached support library v4 in jar. I want to upgrade targetSdk to API 23 to handle Runtime Permissions, hovewer there is no clear explonation in web how to do it, and changing targetSdk in Manifest and gradle isn't enough because classes responsible for runtime permission from API 23 are not found.. could you tell me step by step what should i do ?
And second one : should i use android-support v4 or v7 or other version ? what you would advice ?
support library v4 in jar
Why jar and not compile ... in build.gradle?
hovewer there is no clear explonation in web how to do it
There tons of posts and plenty of libs that can help. Just google for it.
changing targetSdk in Manifest and gradle isn't enough because classes responsible for runtime permission from API 23 are not found
You need to change build SDK to API 23 to compile that code.
should i use android-support v4 or v7 or other version
Runtime Permissions are not related to support library. Leave it as is.
My compiledsdkversion is 23. My Android support library has a 24.0.0-alpha1designation at the end of the string which declares it on my gradle app file. Gradle is compiling with errors stating that the support library should not use a different version than the compiledsdkversion.Any ideas on how to get rid of this error. I don't know how to update the compiledsdkversion.
You should use the latest stable version of the Support Library, which is currently 23.2.1 as per the release notes.
I'm targeting Android 19 (because that's what my phone is running). I want to add a notification with buttons; it seems the right approach is to use appcompat-v7.app.NotificationCompat.
However, when I add appcompat-v7 from the Android Support repository revision 22.2 (via a build.gradle dependency), it includes a file app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.0/res/values-v21/values-v21.xml that doesn't compile because it assumes the target is 21+.
I tried deleting that file, but it gets regenerated.
There doesn't seem to be a way to exclude a file from the build.
So, I need to get an older version of the support library or repository, that doesn't include 21 stuff.
I guess I could import all the sources directly (and leave out the v21 stuff), rather than thru the dependency? I'm not clear where to start with that.
I can use the SDK manager to get older versions of the SDK, but it only offers the latest version of the support library.
to directly answer your question it's all that one line on gradle:
compile 'com.android.support:appcompat-v7:22.2.0'
That last part is the version you're getting. 22.2.0 on the example above.
and on this link you can check the revisions numbers:
https://developer.android.com/tools/support-library/index.html#revisions
But you have a fundamentally wrong approach to your issue. You don't have to target the API for the device you have with you. You can easily and safely target the latest API, use the latest AppCompat features and bug fixes.
Lint will give you a warning every time you try to use a feature that is not from your minimumApi, regardless of the targetAPI
In your gradle build file change the dependency to be the 19 version (the version of the library should match the sdk you are compiling with):
dependencies {
compile 'com.android.support:appcompat-v7:19.1.+'
...
}
Edit: If v19 of the support lib doesn't have NotificationCompat, then you can't use that unless you compile against a later SDK. You can't include a support library with a higher version than your compiled SDK - that's the issue you are running into.
In this case change:
android {
compileSdkVersion 22
...
}
and leave the dependency set to the 22 version of the appcompat support lib