Search code examples
androidandroid-actionbarandroidxappcompat-v7-toolbar

Does Google recommend to use v7 appcompat support Toolbar or androidx?


I am learning how to implement the App/Action bar in Android and I found the Add the app bar Google's guide, which recommends using the v7 appcompat support libraries. The guide is updated to December 2019.

At the same time, I believe Google recommends androidx, which, as far as I understand, is not compatible with the v7 appcompat support libraries.

What is the actual Google standard and what are the pros and cons of the two alternatives?


Solution

  • I found the Add the app bar Google's guide, which recommends using the v7 appcompat support libraries. The guide is updated to December 2019.

    I filed a bug report to try to get them to update this guide. Given my track record of getting documentation bugs fixed, this may take quite some time.

    I believe Google recommends androidx

    Correct.

    which... is not compatible with the v7 appcompat support libraries.

    The story there is a bit complicated, but, it's 2020, so just use the Jetpack/AndroidX version of Toolbar. Probably some of that guide will still be accurate, other than the package names for the classes.

    What is the actual Google standard

    Use androidx classes instead of android.support alternatives for all new development.

    what are the pros and cons of the two alternatives?

    The Android Support Library (android.support) is no longer being maintained. While the code still runs, you will find increasing compatibility challenges both with AndroidX libraries and possibly with new Android features.