androidfirebaseandroid-fragmentsandroidxfirebase-mlkit

Can't depend on Firebase ML Kit


I'm trying to add firebase's ML Kit as a dependency in my android application:

dependencies {
    implementation("com.microblink:blinkinput:${rootProject.ext.blinkInputVersion}@aar") {
        transitive = true
    }

    implementation 'com.google.firebase:firebase-analytics:17.2.1'
    implementation 'com.google.android.gms:play-services-ads:18.3.0'
    implementation 'com.google.android:flexbox:1.1.0'
    implementation 'com.android.billingclient:billing:2.0.3'
    implementation "com.heapanalytics.android:heap-android-client:${heapVersion}"
    implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'

    // this is new!!
    implementation 'com.google.firebase:firebase-ml-vision:24.0.0'

}

When I try to run my app with this dependency I get the following error: Program type already present: androidx.asynclayoutinflater.R

I found this post which suggests adding @aar to the dependency. I tried that and successfully managed to install my app in an emulator but starting getting the following error:

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.glan.input, PID: 20578
    java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/internal/firebase_ml/zzph;
        at com.google.firebase.ml.vision.VisionRegistrar.getComponents(com.google.firebase:firebase-ml-vision@@24.0.0:3)
        at com.google.firebase.components.ComponentRuntime.<init>(com.google.firebase:firebase-common@@19.0.0:56)
        at com.google.firebase.FirebaseApp.<init>(com.google.firebase:firebase-common@@19.0.0:409)
        at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@19.0.0:296)
        at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@19.0.0:264)
        at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@19.0.0:249)
        at com.google.firebase.provider.FirebaseInitProvider.onCreate(com.google.firebase:firebase-common@@19.0.0:51)
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1917)
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1892)
        at com.google.firebase.provider.FirebaseInitProvider.attachInfo(com.google.firebase:firebase-common@@19.0.0:45)
        at android.app.ActivityThread.installProvider(ActivityThread.java:6239)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:5805)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5722)
        at android.app.ActivityThread.-wrap1(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.internal.firebase_ml.zzph" on path: DexPathList[[zip file "/data/app/com.glan.input-LDMhiy6YNZkNhS-vk46FJw==/base.apk"],nativeLibraryDirectories=[/data/app/com.glan.input-LDMhiy6YNZkNhS-vk46FJw==/lib/x86, /data/app/com.glan.input-LDMhiy6YNZkNhS-vk46FJw==/base.apk!/lib/x86, /system/lib, /vendor/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at com.google.firebase.ml.vision.VisionRegistrar.getComponents(com.google.firebase:firebase-ml-vision@@24.0.0:3) 
        at com.google.firebase.components.ComponentRuntime.<init>(com.google.firebase:firebase-common@@19.0.0:56) 
        at com.google.firebase.FirebaseApp.<init>(com.google.firebase:firebase-common@@19.0.0:409) 
        at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@19.0.0:296) 
        at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@19.0.0:264) 
        at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@19.0.0:249) 
        at com.google.firebase.provider.FirebaseInitProvider.onCreate(com.google.firebase:firebase-common@@19.0.0:51) 
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1917) 
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1892) 
        at com.google.firebase.provider.FirebaseInitProvider.attachInfo(com.google.firebase:firebase-common@@19.0.0:45) 
        at android.app.ActivityThread.installProvider(ActivityThread.java:6239) 
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:5805) 
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5722) 
        at android.app.ActivityThread.-wrap1(Unknown Source:0) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:164) 
        at android.app.ActivityThread.main(ActivityThread.java:6494) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 

After some googling I found that I might need to add transitive = true to the dependency with @aar

    implementation ('com.google.firebase:firebase-ml-vision:24.0.0@aar'){
        transitive = true
    }

But when I do that I get the original error again: Program type already present: androidx.asynclayoutinflater.R.

I've tried looking at the dependencies of my program:

 5:08PM /Users/paymahn/glan/BlinkInputSample firebase.ocr ✱ ◼
 ❮❮❮ ./gradlew glan:dependencies

...

debugCompileClasspath - Resolved configuration for compilation for variant: debug
+--- com.microblink:blinkinput:4.1.0
|    \--- androidx.appcompat:appcompat:1.0.0
|         +--- androidx.annotation:annotation:1.0.0
|         +--- androidx.core:core:1.0.0
|         |    +--- androidx.annotation:annotation:1.0.0
|         |    +--- androidx.collection:collection:1.0.0
|         |    |    \--- androidx.annotation:annotation:1.0.0
|         |    +--- androidx.lifecycle:lifecycle-runtime:2.0.0
|         |    |    +--- androidx.lifecycle:lifecycle-common:2.0.0
|         |    |    |    \--- androidx.annotation:annotation:1.0.0
|         |    |    +--- androidx.arch.core:core-common:2.0.0
|         |    |    |    \--- androidx.annotation:annotation:1.0.0
|         |    |    \--- androidx.annotation:annotation:1.0.0
|         |    \--- androidx.versionedparcelable:versionedparcelable:1.0.0
|         |         +--- androidx.annotation:annotation:1.0.0
|         |         \--- androidx.collection:collection:1.0.0 (*)
|         +--- androidx.collection:collection:1.0.0 (*)
|         +--- androidx.cursoradapter:cursoradapter:1.0.0
|         |    \--- androidx.annotation:annotation:1.0.0
|         +--- androidx.legacy:legacy-support-core-utils:1.0.0
|         |    +--- androidx.annotation:annotation:1.0.0
|         |    +--- androidx.core:core:1.0.0 (*)
|         |    +--- androidx.documentfile:documentfile:1.0.0
|         |    |    \--- androidx.annotation:annotation:1.0.0
|         |    +--- androidx.loader:loader:1.0.0
|         |    |    +--- androidx.annotation:annotation:1.0.0
|         |    |    +--- androidx.core:core:1.0.0 (*)
|         |    |    +--- androidx.lifecycle:lifecycle-livedata:2.0.0
|         |    |    |    +--- androidx.arch.core:core-runtime:2.0.0
|         |    |    |    |    +--- androidx.annotation:annotation:1.0.0
|         |    |    |    |    \--- androidx.arch.core:core-common:2.0.0 (*)
|         |    |    |    +--- androidx.lifecycle:lifecycle-livedata-core:2.0.0
|         |    |    |    |    +--- androidx.lifecycle:lifecycle-common:2.0.0 (*)
|         |    |    |    |    +--- androidx.arch.core:core-common:2.0.0 (*)
|         |    |    |    |    \--- androidx.arch.core:core-runtime:2.0.0 (*)
|         |    |    |    \--- androidx.arch.core:core-common:2.0.0 (*)
|         |    |    \--- androidx.lifecycle:lifecycle-viewmodel:2.0.0
|         |    |         \--- androidx.annotation:annotation:1.0.0
|         |    +--- androidx.localbroadcastmanager:localbroadcastmanager:1.0.0
|         |    |    \--- androidx.annotation:annotation:1.0.0
|         |    \--- androidx.print:print:1.0.0
|         |         \--- androidx.annotation:annotation:1.0.0
|         +--- androidx.fragment:fragment:1.0.0
|         |    +--- androidx.core:core:1.0.0 (*)
|         |    +--- androidx.legacy:legacy-support-core-ui:1.0.0
|         |    |    +--- androidx.annotation:annotation:1.0.0
|         |    |    +--- androidx.core:core:1.0.0 (*)
|         |    |    +--- androidx.legacy:legacy-support-core-utils:1.0.0 (*)
|         |    |    +--- androidx.customview:customview:1.0.0
|         |    |    |    +--- androidx.annotation:annotation:1.0.0
|         |    |    |    \--- androidx.core:core:1.0.0 (*)
|         |    |    +--- androidx.viewpager:viewpager:1.0.0
|         |    |    |    +--- androidx.annotation:annotation:1.0.0
|         |    |    |    +--- androidx.core:core:1.0.0 (*)
|         |    |    |    \--- androidx.customview:customview:1.0.0 (*)
|         |    |    +--- androidx.coordinatorlayout:coordinatorlayout:1.0.0
|         |    |    |    +--- androidx.annotation:annotation:1.0.0
|         |    |    |    +--- androidx.core:core:1.0.0 (*)
|         |    |    |    \--- androidx.customview:customview:1.0.0 (*)
|         |    |    +--- androidx.drawerlayout:drawerlayout:1.0.0
|         |    |    |    +--- androidx.annotation:annotation:1.0.0
|         |    |    |    +--- androidx.core:core:1.0.0 (*)
|         |    |    |    \--- androidx.customview:customview:1.0.0 (*)
|         |    |    +--- androidx.slidingpanelayout:slidingpanelayout:1.0.0
|         |    |    |    +--- androidx.annotation:annotation:1.0.0
|         |    |    |    +--- androidx.core:core:1.0.0 (*)
|         |    |    |    \--- androidx.customview:customview:1.0.0 (*)
|         |    |    +--- androidx.interpolator:interpolator:1.0.0
|         |    |    |    \--- androidx.annotation:annotation:1.0.0
|         |    |    +--- androidx.swiperefreshlayout:swiperefreshlayout:1.0.0
|         |    |    |    +--- androidx.annotation:annotation:1.0.0
|         |    |    |    +--- androidx.core:core:1.0.0 (*)
|         |    |    |    \--- androidx.interpolator:interpolator:1.0.0 (*)
|         |    |    +--- androidx.asynclayoutinflater:asynclayoutinflater:1.0.0
|         |    |    |    +--- androidx.annotation:annotation:1.0.0
|         |    |    |    \--- androidx.core:core:1.0.0 (*)
|         |    |    \--- androidx.cursoradapter:cursoradapter:1.0.0 (*)
|         |    +--- androidx.legacy:legacy-support-core-utils:1.0.0 (*)
|         |    +--- androidx.annotation:annotation:1.0.0
|         |    +--- androidx.loader:loader:1.0.0 (*)
|         |    \--- androidx.lifecycle:lifecycle-viewmodel:2.0.0 (*)
|         +--- androidx.vectordrawable:vectordrawable:1.0.0
|         |    +--- androidx.annotation:annotation:1.0.0
|         |    \--- androidx.core:core:1.0.0 (*)
|         \--- androidx.vectordrawable:vectordrawable-animated:1.0.0
|              +--- androidx.vectordrawable:vectordrawable:1.0.0 (*)
|              \--- androidx.legacy:legacy-support-core-ui:1.0.0 (*)
+--- com.google.firebase:firebase-analytics:17.2.1
|    +--- com.google.android.gms:play-services-measurement:17.2.1
|    |    +--- androidx.collection:collection:1.0.0 (*)
|    |    +--- androidx.legacy:legacy-support-core-utils:1.0.0 (*)
|    |    +--- com.google.android.gms:play-services-basement:17.0.0
|    |    |    +--- androidx.collection:collection:1.0.0 (*)
|    |    |    +--- androidx.core:core:1.0.0 (*)
|    |    |    \--- androidx.fragment:fragment:1.0.0 (*)
|    |    +--- com.google.android.gms:play-services-measurement-base:[17.2.1] -> 17.2.1
|    |    |    \--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    |    +--- com.google.android.gms:play-services-measurement-impl:[17.2.1] -> 17.2.1
|    |    |    +--- androidx.collection:collection:1.0.0 (*)
|    |    |    +--- androidx.core:core:1.0.0 (*)
|    |    |    +--- com.google.android.gms:play-services-ads-identifier:17.0.0
|    |    |    |    \--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    |    |    +--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    |    |    +--- com.google.android.gms:play-services-measurement-base:[17.2.1] -> 17.2.1 (*)
|    |    |    \--- com.google.android.gms:play-services-stats:17.0.0
|    |    |         +--- androidx.legacy:legacy-support-core-utils:1.0.0 (*)
|    |    |         \--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    |    \--- com.google.android.gms:play-services-stats:17.0.0 (*)
|    +--- com.google.android.gms:play-services-measurement-api:17.2.1
|    |    +--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    |    +--- com.google.android.gms:play-services-measurement-base:[17.2.1] -> 17.2.1 (*)
|    |    +--- com.google.android.gms:play-services-measurement-impl:[17.2.1] -> 17.2.1 (*)
|    |    +--- com.google.android.gms:play-services-measurement-sdk-api:[17.2.1] -> 17.2.1
|    |    |    +--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    |    |    \--- com.google.android.gms:play-services-measurement-base:[17.2.1] -> 17.2.1 (*)
|    |    +--- com.google.android.gms:play-services-tasks:17.0.0
|    |    |    \--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    |    +--- com.google.firebase:firebase-common:19.0.0
|    |    |    +--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    |    |    +--- com.google.android.gms:play-services-tasks:17.0.0 (*)
|    |    |    \--- com.google.auto.value:auto-value-annotations:1.6.5
|    |    +--- com.google.firebase:firebase-iid:19.0.0
|    |    |    +--- androidx.collection:collection:1.0.0 (*)
|    |    |    +--- androidx.core:core:1.0.0 (*)
|    |    |    +--- androidx.legacy:legacy-support-core-utils:1.0.0 (*)
|    |    |    +--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    |    |    +--- com.google.android.gms:play-services-stats:17.0.0 (*)
|    |    |    +--- com.google.android.gms:play-services-tasks:17.0.0 (*)
|    |    |    +--- com.google.firebase:firebase-common:18.0.0 -> 19.0.0 (*)
|    |    |    \--- com.google.firebase:firebase-iid-interop:17.0.0
|    |    |         +--- com.google.android.gms:play-services-base:17.0.0
|    |    |         |    +--- androidx.collection:collection:1.0.0 (*)
|    |    |         |    +--- androidx.core:core:1.0.0 (*)
|    |    |         |    +--- androidx.fragment:fragment:1.0.0 (*)
|    |    |         |    +--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    |    |         |    \--- com.google.android.gms:play-services-tasks:17.0.0 (*)
|    |    |         \--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    |    \--- com.google.firebase:firebase-measurement-connector:18.0.0
|    |         \--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    \--- com.google.android.gms:play-services-measurement-sdk:17.2.1
|         +--- androidx.collection:collection:1.0.0 (*)
|         +--- com.google.android.gms:play-services-basement:17.0.0 (*)
|         +--- com.google.android.gms:play-services-measurement-base:[17.2.1] -> 17.2.1 (*)
|         \--- com.google.android.gms:play-services-measurement-impl:[17.2.1] -> 17.2.1 (*)
+--- com.google.android.gms:play-services-ads:18.3.0
|    +--- androidx.browser:browser:1.0.0
|    |    +--- androidx.core:core:1.0.0 (*)
|    |    +--- androidx.annotation:annotation:1.0.0
|    |    +--- androidx.interpolator:interpolator:1.0.0 (*)
|    |    +--- androidx.collection:collection:1.0.0 (*)
|    |    \--- androidx.legacy:legacy-support-core-ui:1.0.0 (*)
|    +--- androidx.collection:collection:1.0.0 (*)
|    +--- androidx.core:core:1.0.0 (*)
|    +--- com.google.android.gms:play-services-ads-base:[18.3.0] -> 18.3.0
|    +--- com.google.android.gms:play-services-ads-identifier:17.0.0 (*)
|    +--- com.google.android.gms:play-services-ads-lite:[18.3.0] -> 18.3.0
|    |    +--- com.google.android.gms:play-services-ads-base:[18.3.0] -> 18.3.0
|    |    +--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    |    \--- com.google.android.gms:play-services-measurement-sdk-api:17.1.0 -> 17.2.1 (*)
|    +--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    \--- com.google.android.gms:play-services-gass:[18.3.0] -> 18.3.0
|         +--- com.google.android.gms:play-services-ads-base:[18.3.0] -> 18.3.0
|         +--- com.google.android.gms:play-services-ads-lite:[18.3.0] -> 18.3.0 (*)
|         +--- com.google.android.gms:play-services-basement:17.0.0 (*)
|         \--- com.google.android.gms:play-services-tasks:17.0.0 (*)
+--- com.google.android:flexbox:1.1.0
+--- com.android.billingclient:billing:2.0.3
|    \--- androidx.annotation:annotation:1.0.0
+--- com.heapanalytics.android:heap-android-client:1.3.0-beta.3
+--- com.crashlytics.sdk.android:crashlytics:2.10.1
|    +--- com.crashlytics.sdk.android:crashlytics-core:2.7.0
|    |    +--- io.fabric.sdk.android:fabric:1.4.8
|    |    \--- com.crashlytics.sdk.android:answers:1.4.7
|    |         \--- io.fabric.sdk.android:fabric:1.4.8
|    +--- com.crashlytics.sdk.android:beta:1.2.10
|    |    \--- io.fabric.sdk.android:fabric:1.4.4 -> 1.4.8
|    +--- io.fabric.sdk.android:fabric:1.4.8
|    \--- com.crashlytics.sdk.android:answers:1.4.7 (*)
+--- com.google.firebase:firebase-ml-vision:24.0.0
|    +--- androidx.exifinterface:exifinterface:1.0.0
|    |    \--- androidx.annotation:annotation:1.0.0
|    +--- com.google.android.gms:play-services-auth-base:17.0.0
|    |    +--- androidx.collection:collection:1.0.0 (*)
|    |    +--- com.google.android.gms:play-services-base:17.0.0 (*)
|    |    +--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    |    \--- com.google.android.gms:play-services-tasks:17.0.0 (*)
|    +--- com.google.android.gms:play-services-base:17.0.0 (*)
|    +--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    +--- com.google.android.gms:play-services-tasks:17.0.0 (*)
|    +--- com.google.android.gms:play-services-vision:19.0.0
|    |    +--- com.google.android.gms:play-services-base:17.0.0 (*)
|    |    +--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    |    \--- com.google.android.gms:play-services-vision-common:[19.0.0] -> 19.0.0
|    |         +--- com.google.android.gms:play-services-base:17.0.0 (*)
|    |         +--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    |         +--- com.google.android.gms:play-services-clearcut:17.0.0
|    |         |    +--- androidx.core:core:1.0.0 (*)
|    |         |    +--- com.google.android.gms:play-services-base:17.0.0 (*)
|    |         |    +--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    |         |    +--- com.google.android.gms:play-services-phenotype:17.0.0
|    |         |    |    +--- androidx.core:core:1.0.0 (*)
|    |         |    |    +--- com.google.android.gms:play-services-base:17.0.0 (*)
|    |         |    |    +--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    |         |    |    \--- com.google.android.gms:play-services-tasks:17.0.0 (*)
|    |         |    \--- com.google.android.gms:play-services-tasks:17.0.0 (*)
|    |         +--- com.google.android.gms:play-services-flags:17.0.0
|    |         |    +--- com.google.android.gms:play-services-base:17.0.0 (*)
|    |         |    \--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    |         \--- com.google.android.gms:play-services-phenotype:17.0.0 (*)
|    +--- com.google.android.gms:play-services-vision-common:19.0.0 (*)
|    +--- com.google.android.gms:play-services-vision-image-label:18.0.1
|    |    +--- com.google.android.gms:play-services-base:17.0.0 (*)
|    |    +--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    |    \--- com.google.android.gms:play-services-vision-common:[19.0.0] -> 19.0.0 (*)
|    +--- com.google.firebase:firebase-common:19.0.0 (*)
|    \--- com.google.firebase:firebase-ml-common:[22.0.0] -> 22.0.0
|         +--- androidx.core:core:1.0.0 (*)
|         +--- com.google.android.gms:play-services-base:17.0.0 (*)
|         +--- com.google.android.gms:play-services-basement:17.0.0 (*)
|         +--- com.google.android.gms:play-services-clearcut:17.0.0 (*)
|         +--- com.google.android.gms:play-services-phenotype:17.0.0 (*)
|         +--- com.google.android.gms:play-services-tasks:17.0.0 (*)
|         +--- com.google.firebase:firebase-common:19.0.0 (*)
|         \--- com.google.firebase:firebase-iid:19.0.0 (*)
+--- com.microblink:blinkinput:{strictly 4.1.0} -> 4.1.0 (c)
+--- com.google.firebase:firebase-analytics:{strictly 17.2.1} -> 17.2.1 (c)
+--- com.google.android.gms:play-services-ads:{strictly 18.3.0} -> 18.3.0 (c)
+--- com.google.android:flexbox:{strictly 1.1.0} -> 1.1.0 (c)
+--- com.android.billingclient:billing:{strictly 2.0.3} -> 2.0.3 (c)
+--- com.heapanalytics.android:heap-android-client:{strictly 1.3.0-beta.3} -> 1.3.0-beta.3 (c)
+--- com.crashlytics.sdk.android:crashlytics:{strictly 2.10.1} -> 2.10.1 (c)
+--- com.google.firebase:firebase-ml-vision:{strictly 24.0.0} -> 24.0.0 (c)
+--- androidx.appcompat:appcompat:{strictly 1.0.0} -> 1.0.0 (c)
+--- com.google.android.gms:play-services-measurement:{strictly 17.2.1} -> 17.2.1 (c)
+--- com.google.android.gms:play-services-measurement-api:{strictly 17.2.1} -> 17.2.1 (c)
+--- com.google.android.gms:play-services-measurement-sdk:{strictly 17.2.1} -> 17.2.1 (c)
+--- androidx.core:core:{strictly 1.0.0} -> 1.0.0 (c)
+--- androidx.collection:collection:{strictly 1.0.0} -> 1.0.0 (c)
+--- com.google.android.gms:play-services-basement:{strictly 17.0.0} -> 17.0.0 (c)
+--- com.google.android.gms:play-services-ads-identifier:{strictly 17.0.0} -> 17.0.0 (c)
+--- androidx.browser:browser:{strictly 1.0.0} -> 1.0.0 (c)
+--- com.google.android.gms:play-services-ads-base:{strictly 18.3.0} -> 18.3.0 (c)
+--- com.google.android.gms:play-services-ads-lite:{strictly 18.3.0} -> 18.3.0 (c)
+--- com.google.android.gms:play-services-gass:{strictly 18.3.0} -> 18.3.0 (c)
+--- androidx.annotation:annotation:{strictly 1.0.0} -> 1.0.0 (c)
+--- com.crashlytics.sdk.android:crashlytics-core:{strictly 2.7.0} -> 2.7.0 (c)
+--- io.fabric.sdk.android:fabric:{strictly 1.4.8} -> 1.4.8 (c)
+--- com.crashlytics.sdk.android:answers:{strictly 1.4.7} -> 1.4.7 (c)
+--- com.crashlytics.sdk.android:beta:{strictly 1.2.10} -> 1.2.10 (c)
+--- com.google.android.gms:play-services-tasks:{strictly 17.0.0} -> 17.0.0 (c)
+--- com.google.firebase:firebase-common:{strictly 19.0.0} -> 19.0.0 (c)
+--- com.google.android.gms:play-services-base:{strictly 17.0.0} -> 17.0.0 (c)
+--- androidx.exifinterface:exifinterface:{strictly 1.0.0} -> 1.0.0 (c)
+--- com.google.android.gms:play-services-auth-base:{strictly 17.0.0} -> 17.0.0 (c)
+--- com.google.android.gms:play-services-vision:{strictly 19.0.0} -> 19.0.0 (c)
+--- com.google.android.gms:play-services-vision-common:{strictly 19.0.0} -> 19.0.0 (c)
+--- com.google.android.gms:play-services-vision-image-label:{strictly 18.0.1} -> 18.0.1 (c)
+--- com.google.firebase:firebase-ml-common:{strictly 22.0.0} -> 22.0.0 (c)
+--- androidx.cursoradapter:cursoradapter:{strictly 1.0.0} -> 1.0.0 (c)
+--- androidx.legacy:legacy-support-core-utils:{strictly 1.0.0} -> 1.0.0 (c)
+--- androidx.fragment:fragment:{strictly 1.0.0} -> 1.0.0 (c)
+--- androidx.vectordrawable:vectordrawable:{strictly 1.0.0} -> 1.0.0 (c)
+--- androidx.vectordrawable:vectordrawable-animated:{strictly 1.0.0} -> 1.0.0 (c)
+--- com.google.android.gms:play-services-measurement-base:{strictly 17.2.1} -> 17.2.1 (c)
+--- com.google.android.gms:play-services-measurement-impl:{strictly 17.2.1} -> 17.2.1 (c)
+--- com.google.android.gms:play-services-stats:{strictly 17.0.0} -> 17.0.0 (c)
+--- com.google.android.gms:play-services-measurement-sdk-api:{strictly 17.2.1} -> 17.2.1 (c)
+--- com.google.firebase:firebase-iid:{strictly 19.0.0} -> 19.0.0 (c)
+--- com.google.firebase:firebase-measurement-connector:{strictly 18.0.0} -> 18.0.0 (c)
+--- androidx.legacy:legacy-support-core-ui:{strictly 1.0.0} -> 1.0.0 (c)
+--- androidx.interpolator:interpolator:{strictly 1.0.0} -> 1.0.0 (c)
+--- androidx.lifecycle:lifecycle-runtime:{strictly 2.0.0} -> 2.0.0 (c)
+--- androidx.versionedparcelable:versionedparcelable:{strictly 1.0.0} -> 1.0.0 (c)
+--- com.google.android.gms:play-services-clearcut:{strictly 17.0.0} -> 17.0.0 (c)
+--- com.google.android.gms:play-services-phenotype:{strictly 17.0.0} -> 17.0.0 (c)
+--- com.google.android.gms:play-services-flags:{strictly 17.0.0} -> 17.0.0 (c)
+--- com.google.auto.value:auto-value-annotations:{strictly 1.6.5} -> 1.6.5 (c)
+--- androidx.documentfile:documentfile:{strictly 1.0.0} -> 1.0.0 (c)
+--- androidx.loader:loader:{strictly 1.0.0} -> 1.0.0 (c)
+--- androidx.localbroadcastmanager:localbroadcastmanager:{strictly 1.0.0} -> 1.0.0 (c)
+--- androidx.print:print:{strictly 1.0.0} -> 1.0.0 (c)
+--- androidx.lifecycle:lifecycle-viewmodel:{strictly 2.0.0} -> 2.0.0 (c)
+--- com.google.firebase:firebase-iid-interop:{strictly 17.0.0} -> 17.0.0 (c)
+--- androidx.customview:customview:{strictly 1.0.0} -> 1.0.0 (c)
+--- androidx.viewpager:viewpager:{strictly 1.0.0} -> 1.0.0 (c)
+--- androidx.coordinatorlayout:coordinatorlayout:{strictly 1.0.0} -> 1.0.0 (c)
+--- androidx.drawerlayout:drawerlayout:{strictly 1.0.0} -> 1.0.0 (c)
+--- androidx.slidingpanelayout:slidingpanelayout:{strictly 1.0.0} -> 1.0.0 (c)
+--- androidx.swiperefreshlayout:swiperefreshlayout:{strictly 1.0.0} -> 1.0.0 (c)
+--- androidx.asynclayoutinflater:asynclayoutinflater:{strictly 1.0.0} -> 1.0.0 (c)
+--- androidx.lifecycle:lifecycle-common:{strictly 2.0.0} -> 2.0.0 (c)
+--- androidx.arch.core:core-common:{strictly 2.0.0} -> 2.0.0 (c)
+--- androidx.lifecycle:lifecycle-livedata:{strictly 2.0.0} -> 2.0.0 (c)
+--- androidx.arch.core:core-runtime:{strictly 2.0.0} -> 2.0.0 (c)
\--- androidx.lifecycle:lifecycle-livedata-core:{strictly 2.0.0} -> 2.0.0 (c)

...

But I can't figure out how to use this to correct the problem, I see the asynclayoutinflator included twice but I'm not sure how to exclude one of those.


Solution

  • I don't know exactly what happened (I spent hours trying to fix this) but I think adding

    configurations.all {
        exclude group: "androidx.asynclayoutinflater", module: "asynclayoutinflater"
    }
    

    fixed it all.

    My final app level build.gradle looks like

    dependencies {
        def appcompat_version = "1.1.0"
    
        implementation "androidx.appcompat:appcompat:$appcompat_version"
        implementation 'com.google.firebase:firebase-analytics:17.2.1'
        implementation 'com.google.android.gms:play-services-ads:18.3.0'
        implementation 'com.google.android:flexbox:1.1.1'
        implementation 'com.android.billingclient:billing:2.0.3'
        implementation "com.heapanalytics.android:heap-android-client:${heapVersion}"
        implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
        implementation 'com.google.firebase:firebase-ml-vision:24.0.0'
    
    
    //     CameraX core library.
        def camerax_version = "1.0.0-alpha06"
        implementation "androidx.camera:camera-core:${camerax_version}"
    
    
    }
    configurations.all {
        exclude group: "androidx.asynclayoutinflater", module: "asynclayoutinflater"
    }
    

    and it builds and installs successfully.