Photo by Johnny Wharris

Tutorial: How to Fix a Failing Android Build Due to [androidx.core:core:1.0.0] Issues (June 2019)

If you’re a React Native developer like me, you may have been surprised to see your Android build that JUST WORKED, failing and failing and failing again.

The issue, if you’re in Android Studio, went something like this:

Did you think to yourself “Huh? AndroidX? I’m not supporting that yet.”, then follow along. Here’s how to fix the issue without adding AndroidX support.

What Happened?

Google pulled a fast one on us yesterday (June 17, 2019) and released a MAJOR version update on it’s Google Play and Firebase libraries. That means, any dependencies imported to the tune of:

…(note the +) will be affected.

How to Fix It

  1. Hop over to your /android/app/build.gradle file and check out your dependencies. Search for any instance of play-services or firebase* and see if it’s pulling in the latest version (+).

2. Head over to MVNRepository and search for the troublesome dependencies. Here you’ll be able to find the last released version of your module. Update /android/app/build.gradle to that version along with a force flag to handle any version conflicts:

3. Time to handle your node_modules. Navigate into /android and run the following command:

This will generate a dependency tree for your entire project.

4. Grab the tree and paste in into a text editor. Search for any instance of play-services or firebase* and navigate up the tree to see where the module is being used. In this case, react-native-push-notifications has a com.google.android.gms:play-services-gcm:+ dependency.

5. Patch those packages! If I am in a time crunch, I will use patch-package, a genius library that lets you make changes to a package and then creates a patch for you to store with your project. The patch will then apply via a postinstall any time you or someone on your team runs npm i.

In my case, I navigated to the build.gradle file of react-native-push-notification, made my updates, ran:

…and voila! I have a patch!

And You’re Done!

In my case, I needed to apply patches to both react-native-push-notification and react-native-push-notification.

Do note that this is just a band-aid until you’re ready to support AndroidX and all its glory 🤖

Hope this helps!

*For a full list of updated dependencies navigate here.

👋 Hi! I’m Juliette. I work at Eventric as a Software Developer. Come follow me on Twitter at @Juliette.

--

--

React & React Native Developer. Building awesome things @Eventric.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Juliette Rapala

React & React Native Developer. Building awesome things @Eventric.