Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Try to migrate AndroidX to Android AppCompat

I have errors when migrate from AndroidX to Appcompat. Here is log build:

Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.0.1] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:18:5-138:19 to override.
like image 869
Dương Nguyễn Văn Avatar asked Mar 04 '19 04:03

Dương Nguyễn Văn


People also ask

What does it mean to migrate to AndroidX?

AndroidX replaces the original support library APIs with packages in the androidx namespace. Only the package and Maven artifact names changed; class, method, and field names did not change. Caution: As of late 2021, most of the library ecosystem already supports AndroidX natively.

What is AndroidX AppCompat?

Android AppCompat Library 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.

Why we need to migrate to AndroidX?

The Android Support Library has reached the end of its life. 28.0 was the last release of the Android Support namespace and the namespace is no longer maintained. So, if you want bug fixes or new features that would have previously gone into the Support Library, you need to migrate to AndroidX.

Can I use library that used Android support with AndroidX projects?

Note: 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.


1 Answers

So you want to migrate back to support from androidX. If that will be the case the remove below libs from build.gradle and add old support library instead.

androidx.core:core:1.0.1

And also remove below two properties in gradle.properties files.

android.useAndroidX=true

android.enableJetifier=true

Or if you want to migrate to Androidx then add these two properties to gradle.properties file.

android.useAndroidX=true

android.enableJetifier=true
like image 141
Hussnain Haidar Avatar answered Sep 20 '22 23:09

Hussnain Haidar