Anyline / anyline-ocr-cordova-module

Anyline Cordova Module for iOS and Android
https://anyline.com/
Other
27 stars 25 forks source link

Android 9.0.0 Firebase ML conflict with Play Services - Duplicate classes #48

Closed dimitriscsd closed 2 years ago

dimitriscsd commented 3 years ago

Anyline Cordova Plugin version: 24.1.0 or 25.0.0

I'm submitting a ... [x] bug report [ ] feature request [ ] general question

Occurring on ... [x] Android [ ] iOS

Current behavior: After upgrading to cordova-android version 9.0.0 and enabling androidX, there is some kind of conflict with firebase. I am getting the following error at buildtime:

Task :app:checkDebugDuplicateClasses FAILED

FAILURE: Build failed with an exception.

If I remove the anyline plugin, it builds just fine.

Expected behavior: This would just work with android 8.0.0

Steps to reproduce: I am using this in combination with cordova-plugin-fcm-with-dependecy-updated I have also tried with version 25.0.0 and the results are the same.

dimitriscsd commented 3 years ago

Hello. One thing I noticed initially is that when I add the following code into my build.gradle, everything builds fine. I believe this has to do with versions of these packages, as what this does is override all dependencies to the latest version.

configurations.all {
    resolutionStrategy {
        force 'com.google.android.gms:play-services-vision-common:+'
        force 'com.google.android.gms:play-services-vision-face-contour-internal:+'
        force 'com.google.firebase:firebase-ml-vision-face-model:+'
    }
}

That got me thinking and I looked further. I believe the issue is perfectly described here:

https://github.com/firebase/firebase-android-sdk/issues/1904

Apparently, the anyline plugin needs to migrate to the new ML kit, the guide for which is linked at the last comment of the discussion above.

ALTERNATIVELY (but i assume not valid forever) I have found a workaround that allows this to work, as per instructions on

https://firebase.google.com/support/release-notes/android#mlkit-self-serve-fixes

Screenshot from 2020-11-05 10-56-39

So with the instructions above, the gradle file for the anyline plugin (with updated recent versions) will look like this:

dependencies {
    implementation 'com.google.firebase:firebase-ml-vision:24.1.0'
    implementation 'com.google.android.gms:play-services-vision:20.1.1'
    implementation 'com.google.android.gms:play-services-vision-common:19.1.1'
    implementation 'com.google.firebase:firebase-ml-vision-face-model:20.0.2'
    implementation 'com.google.android.gms:play-services-vision-face-contour-internal:16.0.2'
    implementation 'io.anyline:anylinesdk:25-NoDocUI'
}

With the above, the issue is solved and everything builds properly. It would be nice if you guys could please make a new release fixing this, as it's not correct for us to be editing plugin code manually. Plugins are not part of our version control system.

dimitriscsd commented 3 years ago

I have submitted a pull request with the workaround mentioned above: https://github.com/Anyline/anyline-ocr-cordova-module/pull/49

However a migration to the new ML kit would be the proper long term solution.

berndkamplanyline commented 2 years ago

We don't actively monitor the Github Issues, please raise a support request using the Anyline Helpdesk. Link to Anyline Helpdesk: https://anyline.atlassian.net/servicedesk/customer/portal/2/group/6

When raising a support request based on this Github Issue, please fill out and include the following information:


Support request concerning Anyline Github Repository: [URL to relevant Anyline Github Repository here] Support request based on Github Issue: [URL to relevant Github Issue here]


Thank you so much!