If so, it seems actionbarsherlock lack of class PopupMenu and so on
If not, I can't import both of the libraries in the same project. It says some attributes conflict.
How to overcome this?
No it is not a replacement, in fact with the release of AppCompat in v7 ABS is now considered deprecated and you should use the standard google support library to use the actionbar.
the point of the ABS library was to have a way to show an actionbar on devices < 3.0 and now that you can with the support lib v7 it is not needed
Absolutely not. ActionBarSherlock is an extension of the compatibility library designed to Facilitate the use of the Action Bar design pattern across all versions of Android. The Android Support Library package is a set of code libraries that provide backward-compatible versions of Android framework APIs as well as features that are only available through the library APIs. Each Support Library is backward-compatible to a specific Android API level. This design means That your applications can use the libraries' features and still be compatible with devices running Android 1.6 (API level 4) and up.
Related
Should I select the Use legacy android.support libraries option when creating a new project? What will happen if I don't select this option?
A little context:
Up until recently, almost every Android app used the android.support libraries so that they could use features introduced on new Android versions also on older Android versions. You can read about it here: https://developer.android.com/topic/libraries/support-library
Recently, Google announced that there would be no new releases for the support library, and that instead the support library would become a new library called AndroidX. Here's their announcement:
With the release of Android 9.0 (API level 28) there is a new version
of the support library called AndroidX which is part of Jetpack. The
AndroidX library contains the existing support library and also
includes the latest Jetpack components.
You can continue to use the support library. Historical artifacts
(those versioned 27 and earlier, and packaged as android.support.*)
will remain available on Google Maven. However, all new library
development will occur in the AndroidX library.
We recommend using the AndroidX libraries in all new projects. You
should also consider migrating existing projects to AndroidX as well.
So all Android apps should now aim to use AndroidX, instead of the old support library. When you create a new project in Android Studio, it will by default use AndroidX, but you can still choose to Use legacy android.support libraries if you wish, by clicking the checkbox you found.
Most of the time, you probably want to use AndroidX
With the release of Android 9.0 (API level 28) there is a new version of the support library called AndroidX which is part of Jetpack. The AndroidX library contains the existing support library and also includes the latest Jetpack components.
Support Library
If you check this option, the android studio will use android.support library otherwise it will use androidx library.
the android.support library is deprecated, so you don't need to check this option.
The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren't a part of the framework APIs. Compatible on devices running API 14 or later.
Check the artifact-mappings and also check support-library
When developing apps that support multiple API versions, you may want a standard way to provide newer features on earlier versions of Android or gracefully fall back to equivalent functionality. Rather than building code to handle earlier versions of the platform, you can leverage these libraries to provide that compatibility layer. In addition, the Support Libraries provide additional convenience classes and features not available in the standard Framework API for easier development and support across more devices.
I want to use AndroidX library, but in the official Google developer website, they said it works with Android 9 and SDK 28, and I’m using Android 6 with SDK 23, can I use AndroidX in my project? Or should I continue to use support library ? I found no information on the Internet.
Thanks.
Yes, you can use AndroidX and you should use it. It provides complete back compatibility just as support library does.Actually it is nothing but a major improvement to support library. Android have introduced it in Jetpack and from now on, the new features to support library would be introduced in AndroidX. So you should use it.
Keep in mind, you have to set it up in gradle.properties file as mentioned in the android documentation. https://developer.android.com/jetpack/androidx
Our app uses now a min Android API 19, so we don't really need the support lib anymore, only for the ViewPager would we need an alternative. But the question I was making myself is if it is better to use e.g. DialogFragment from the support lib rather than the one from the framework itself? I was thinking in a possible advantage of doing so where for example the code in the support lib has bug fixes, so if I use it I would have the fixes also on older Android versions, if not then I may get some errors/bugs etc. on older versions, have you some thoughts about this?
IMO it's wise to continue to use the support library versions anyway regardless of your minSdk version - the support library is regularly updated and likely has various bug fixes compared to the shipped platform versions.
As you say as well, it means that you can rely on one implementation.
The only upside that I can see to dropping the support libraries and using the platform implementation is a smaller APK/lower method count, which may or may not be worth it for you.
Yes. That's one advantage of using Support library API over the SDK one - you might get bug fixes in the support library which fixes on all supported Android versions.
And we can choose the version of the support library. If there are some compatibility issues in the latest version, we can use the old version of support library as a temporary solution, even targeting the latest SDK version.
I am developing an app that work from min sdk version 19 onwards. i'm currently using AppCompatActivity, support v4 fragments and support v7 lib..
Is this actually needed for this app?
Can I avoid all support libs..?
Does that increases app performance?
No, you can't avoid all support lib.
It will not affect on your application performance. You can definitely avoid adding third party lib in your project till it is necessary to add.
Please read this link. It will give you more detail about Android support libs.
http://martiancraft.com/blog/2015/06/android-support-library/
Question:
When should be used android.support.* packages, and when android.*?
Would love next facts considered while answering:
Not required to support old android versions
ViewPager and other features available in support-only are desired
If it can always be done in support, then why bother with native library?
Can support/native library be disabled in IDE, so that I stop accidentally importing wrong packages?
Support library is used to make your app capable to run on android lower versions also.
You should definitely read the documentation.
android.support.* is used to support older devices that does not have new Android API.
For example, Fragments were introduced from HONEYCOMB, that's why you should use support package, if you are planning to support Android 2.*.