Android: combining the same library's different versions where one is old and one is migrated in a project

185 Views Asked by At

For my image processing project on android, I need to use the two libraries:

  1. android_face_detection

  2. EPassportNFCReader

I want to combine these to libraries in a project to make a library and use them in my real project. There is an inconsistency in the dependencies. I've figured out that the following libraries don't work together since one of them is the migrated version of the other.

 com.google.firebase:firebase-ml-vision:24.1.0       //used by 1.
 com.google.android.gms:play-services-mlkit-text-recognition:16.1.2  //used by 2.

I've figured out that Google migrated the firebase-ml-vision to com.google.android.gms. I tried to migrate the first project but figured out that the migration is not easy for the first library.

Is there a way to use those together?

The duplicate errors I've got if I put the libraries together:

Duplicate class com.google.android.gms.internal.vision.zzbl found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzbn found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzbo found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzbp found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzbq found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzbr found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzbs found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzbt found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzbx found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzkf found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzkh found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzki found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzkj found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzkk found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzkl found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzkm found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzkn found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzko found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
Duplicate class com.google.android.gms.internal.vision.zzkp found in modules play-services-vision-common-19.1.3-runtime (com.google.android.gms:play-services-vision-common:19.1.3) and play-services-vision-face-contour-internal-16.0.0-runtime (com.google.android.gms:play-services-vision-face-contour-internal:16.0.0)
1

There are 1 best solutions below

0
On

The suggestion would be NOT to mixed use of these two libraries, since the symbol duplication issues mentioned above.

We provided a migration doc here: https://developers.google.com/ml-kit/migration/android

We are happy to help if there is any migration issue in the process.