-1

I'm dipping my feet into android / gradle builds. And saw this line is some of the examples

compile "com.android.support:appcompat-v7:23.0.1"

Not entirely sure what this is. My project is targeting api 26 with minSdkVersion of 23.

When would I use appcompat and in my case do I need to use 23 or 26?

Ilja
  • 44,142
  • 92
  • 275
  • 498
  • Those are Support libraries and `23.0.1` indicates the version. Read [This](https://stackoverflow.com/questions/18271429/difference-between-android-support-v7-appcompat-and-android-support-v4). – ADM Mar 28 '18 at 08:34
  • Have a look at [this](https://stackoverflow.com/questions/35553306/what-is-appcompat) as well – udit7395 Mar 28 '18 at 08:34
  • 1
    Possible duplicate of [What is AppCompat?](https://stackoverflow.com/questions/35553306/what-is-appcompat) – Zoe Mar 28 '18 at 08:40

1 Answers1

0

AppCompat is a set of support libraries which can be used to make the apps developed with newer versions to work with older versions.In your case AppCompat is there to support version 23

my advice is to design your gradle like this:

ext {
    supportLibVersion = '27.0.1' //this should be the latest published version
}

compile "com.android.support:appcompat-v7:${supportLibVersion}"
compile "com.android.support:design:${supportLibVersion}"
compile "com.android.support:palette-v7:${supportLibVersion}"
compile "com.android.support:customtabs:${supportLibVersion}"
compile "com.android.support:gridlayout-v7:${supportLibVersion}"
Ege Kuzubasioglu
  • 5,991
  • 12
  • 49
  • 85
  • Gotcha, in essence I need to add one for just my minSdk target, or would I also need to specify api 24 and api 25 support libraries to ensure 23 - 26 works across the board? – Ilja Mar 28 '18 at 08:38
  • 1
    No in fact you have to keep the latest available support library version there, not 23, see my edit – Ege Kuzubasioglu Mar 28 '18 at 08:40