How to download an old version of the Android support library?

I orient Android 19 (because this is what my phone works). I want to add a notification using buttons; seems like the right approach is to use appcompat-v7.app.NotificationCompat.

However, when I add appcompat-v7 from version 22.2 of the Android support repository (via the build.gradle dependency), it includes the file app / build / intermediates / exploded-aar / com.android.support / appcompat-v7 / 22.2.0 /res/values-v21/values-v21.xml, which does not compile because it assumes the target is 21 +.

I tried to delete this file, but it is being restored.

There seems to be no way to exclude the file from the assembly.

So, I need to get an older version of the support library or repository, which does not include 21 files.

I assume that I can import all sources directly (and not use v21 stuff), and not through dependency? I don’t know where to start. I can use the SDK manager to get older versions of the SDK, but it only offers the latest support library.

+5
source share
2 answers

to directly answer your question, all that one line on gradle:

compile 'com.android.support:appcompat-v7:22.2.0' 

This last part is the version you get. 22.2.0 in the above example.

and from this link you can check the version numbers: https://developer.android.com/tools/support-library/index.html#revisions

But you have a fundamentally wrong approach to your problem. You do not need to configure the API for the device that you have. You can easily and safely configure the latest API, use the latest AppCompat functions and bug fixes.

Lint will warn you every time you try to use a function other than your minimumApi , regardless of targetAPI

+2
source

In your gradle build file, change the dependency as version 19 (the library version should match the sdk command you are compiling):

 dependencies { compile 'com.android.support:appcompat-v7:19.1.+' ... } 

Edit: if v19 of the support library does not have NotificationCompat, then you cannot use this unless you compile a later SDK. You cannot enable a support library with a higher version than your compiled SDK, which is the problem you are working with.

In this case, change:

 android { compileSdkVersion 22 ... } 

and leave the dependency set in appcompat lib version 22 support

+1
source

All Articles