Add androidx dependency to Android system source code

Add androidx dependency to Android system source code

AndroidX is the product of finishing the android.support.xxx package. Because the previous support package was too confusing, Google launched AndroidX.

Android version 28.0.0 (9.0) is the last version to support the support library.

Google will no longer release android.support library versions. All new features will be developed in the androidx namespace.

So support can be used before Android 9.0, and androidx will be used after Android 10.0.

androidx has optimized RecycleView, and the package name has also changed, and other controls related to support have modified the package name.

Projects generated with versions after AS3.2 support AndroidX by default, and the UI controls used are also under the androidx package.

When using the Android source code to compile the AS project, it will fail to compile, prompting that the androidx package is missing.

If you use AppCompatActivity, an error will be prompted when compiling: package androidx.appcompat.app does not exist

Add the following in the Android.mk corresponding to the system application,


LOCAL_STATIC_ANDROID_LIBRARIES := \
    androidx.recyclerview_recyclerview \
    androidx.preference_preference \
    androidx.appcompat_appcompat \
    androidx.annotation_annotation \
    androidx.legacy_legacy-preference-v14 \
    androidx.leanback_leanback-preference \
    androidx.leanback_leanback \

Add this dependency to the system source code to use androidx related attributes.

Old support dependencies are generally as follows:

LOCAL_STATIC_ANDROID_LIBRARIES := \
    android-support-v7-recyclerview \
    android-support-v7-preference \
    android-support-v7-appcompat \
    android-support-v14-preference \
    android-support-v17-preference-leanback \
    android-support-v17-leanback \
    android-support-tv-provider \
    android-arch-lifecycle-extensions

Different versions are required, which is more troublesome! So androidx is a good choice.

Android checks the libraries that exist in the source code compilation:

https://blog.csdn.net/wenzhi20102321/article/details/122889502

Mutual encouragement: Let's work harder in the new year.

Guess you like

Origin blog.csdn.net/wenzhi20102321/article/details/122889764