After the 17th of July update to the Google Play Services, some of you who've cleaned up your React Native Android project before a build, might have encountered an error similar to this
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.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:52:5-309:19 to override.
For normal Android applications, the solution is just migrating to AndroidX and whatever isn't using AndroidX, Gradle deals with converting the import statements on build time by using Jetifier. But Gradle's Jetifier only works on already packaged Android modules. It doesn't work on native React Native modules that bring their full native source code projects intact, and are compiled when you start your React Native app.
For those cases, the solution is:
- Install this package and follow its instructions. If your project still doesn't start after that, follow the extra steps below...
- Go to your
android/app/build.gradle
file, and exchange all dependencies that are inside the Arctifact Mappings section in the AndroidX Migration guide with the new AndroidX build artifact paths. - Go to your own native code inside
android/app/src
and do the same with the import statements refering to the Old build artifacts - Run your app again.
- Comment this post :D
Good luck. BTW, first article here on DEV.TO
Top comments (0)