Ok I've been tackling this issue myself for the last day or so. nightmare.
but I have it working now at least for the project I've been working on which is quite large and with lots of additional android dependencies.
See this issue where Mike Hardy has been a great help. https://github.com/mikehardy/jetifier/issues/27
I would recommend to avoid AndroidX until 0.60.0 has landed.
SOURCE OF THE PROBLEM
the source of the problem for most of us is the +
range selector in gradle dependencies.
as shown here as an example in react-native-google-analytics-bridge:
compile "com.google.android.gms:play-services-analytics:${safeExtGet('googlePlayServicesVersion', '+')}"
compile "com.google.android.gms:play-services-tagmanager-v4-impl:${safeExtGet('googlePlayServicesVersion', '+')}"
for most of us we're not setting a googlePlayServicesVersion value in the top level android/build.gradle
so we'll want to specify googlePlayServicesVersion = "16.+"
+ because theres various other google service packages available and they're not all at the same version number. this will capture 16.X.X and not go above. 17.X.X holds further issues.
And we also want to set supportLibVersion to 28.0.0 which is used by the android support libraries: com.android.support:appcompat-v7 the most common.
SOLUTION
android/build.gradle
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 21
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
googlePlayServicesVersion = "16.+"
}
...
AndroidManifest.xml
top line:
<manifest
xmlns:tools="http://schemas.android.com/tools"
application tag:
tools:replace="android:appComponentFactory"
android:appComponentFactory="android.support.v4.app.CoreComponentFactory"
ensure your gradle-wrapper.properties using 4.10.1
distributionUrl=https://services.gradle.org/distributions/gradle-4.10.1-all.zip
and finally ensure you are not using android X.
gradle.properties:
android.enableJetifier=false
android.useAndroidX=false
Additional Step (You might need this)
failing that doesn't work try adding jetifier as well. We'll use this to run through your node_modules and ensure everything is using the non androidx libraries.
npm i jetifier --save-dev
or yarn add jetifier --dev
then add to postinstall script
"scripts": {
"postinstall": "jetify -r"
}