Skip to content
This repository has been archived by the owner on Oct 24, 2022. It is now read-only.

com.google.zxing.aztec.AztecDetectorResult issue with phonegap-plugin-barcodescanner plugin #777

Closed
vvarda opened this issue Jul 1, 2019 · 15 comments

Comments

@vvarda
Copy link

vvarda commented Jul 1, 2019

Guys, #550 issue also reproduces even on 5.0.2 SDK version.

cordova-cli: 8.1.2
cordova-android: 8.0.0
cordova-plugin-facebook4: 5.0.0
FACEBOOK_ANDROID_SDK_VERSION=5.0.2

cordova build android command:

> Task :app:transformClassesWithMultidexlistForDebug FAILED
40 actionable tasks: 10 executed, 30 up-to-date
D8: Program type already present: com.google.zxing.aztec.AztecDetectorResult

P.S.: that config works, but already deprecated

cordova-plugin-facebook4: 4.0.0
FACEBOOK_ANDROID_SDK_VERSION=4.25.0

How to solve?

@peterpeterparker
Copy link
Collaborator

See #550 (comment) for a proposed solution

And PR are welcomed

@vvarda
Copy link
Author

vvarda commented Jul 1, 2019

@peterpeterparker that package is not compatible with FACEBOOK_ANDROID_SDK_VERSION="5.+". Thx.

@shaileshsakaria
Copy link

shaileshsakaria commented Jul 8, 2019

Hi @peterpeterparker, I am also facing the same issue as below.

Error > com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/zxing/aztec/AztecDetectorResult.class

I have a mobile application built with IONIC 1 - which is in production. In order to take the Facebook ad configuration, it is required now to upgrade the Facebook SDK version 5.+.

Here is my environment set up as below,

ionic 2.2.1

cordova-cli 7.1.0

cordova android 7.1.3

node 10.15.3

npm 6.4.1

cordova-plugin-facebook4: 5.0.0

FACEBOOK_ANDROID_SDK_VERSION=5.0.1


Cordova plugin list:

card.io.cordova.mobilesdk 2.1.0 "CardIO"

cl.rmd.cordova.dialoggps 0.0.2 "DialogGPS"

cordova-plugin-actionsheet 2.3.3 "ActionSheet"

cordova-plugin-app-version 0.1.9 "AppVersion"

cordova-plugin-camera 4.0.3 "Camera"

cordova-plugin-console 1.1.0 "Console"

cordova-plugin-device 1.1.7 "Device"

cordova-plugin-dialogs 1.3.4 "Notification"

cordova-plugin-facebook4 5.0.0 "Facebook Connect"

cordova-plugin-file 6.0.1 "File"

cordova-plugin-file-opener2 2.0.19 "File Opener2"

cordova-plugin-file-transfer 1.7.1 "File Transfer"

cordova-plugin-geolocation 4.0.1 "Geolocation"

cordova-plugin-inappbrowser 1.7.2 "InAppBrowser"

cordova-plugin-network-information 1.3.4 "Network Information"

cordova-plugin-screen-orientation 1.4.2 "Screen Orientation"

cordova-plugin-splashscreen 3.2.2 "Splashscreen"

cordova-plugin-statusbar 2.4.2 "StatusBar"

cordova-plugin-whitelist 1.3.3 "Whitelist"

cordova-plugin-x-socialsharing 5.4.3 "SocialSharing"

cordova-support-google-services 1.1.0 "cordova-support-google-services"

cordova.plugins.diagnostic 3.9.2 "Diagnostic"

es6-promise-plugin 4.2.2 "Promise"

ionic-plugin-keyboard 2.2.1 "Keyboard"

org.apache.cordova.plugin.cache 1.0.5 "Clear Cache"

phonegap-plugin-barcodescanner 8.1.0 "BarcodeScanner"

phonegap-plugin-multidex 1.0.0 "Multidex"

phonegap-plugin-push 2.2.3 "PushPlugin"

Does anyone have any suggestion for a workaround or proposed solution?

Thanks for your help!

@JustasKuizinas
Copy link

would be nice to have optional variables to ignore zxing while adding cordova-plugin-facebook4 plugin

@shaileshsakaria
Copy link

Hi @JustasKuizinas - Thank you for your reply.

Can you tell me how to ignore zxing while add plugin? As I can not see any option to ignore it.

I found this plugin https://github.com/AndreiTelteu/cordova-plugin-facebook4-no-zxing but not sure it is reliable to use or not as it is provided by the third party.

@JustasKuizinas
Copy link

@shaileshsakaria cordova-plugin-facebook4 doesn't have the option to ignore zxing, but it would be nice if it had

@wilsolutions
Copy link

Hi, please, is there any plan to have optional variables to ignore zxing as suggested by
@JustasKuizinas ?

tkx

@JustasKuizinas
Copy link

@shaileshsakaria @wilsolutions
If you don't want to use https://github.com/AndreiTelteu/cordova-plugin-facebook4-no-zxing
here is how to make it work it with cordova-plugin-facebook4 until optional variables will be added:

  1. Remove android platform.

  2. Install cordova-plugin-facebook4

  3. Copy this

dependencies {
    compile("com.facebook.android:facebook-android-sdk:4.37.0") {
        exclude group: 'com.google.zxing'
    }
}

to ../plugins/cordova-plugin-facebook4/build.gradle

  1. Edit ../plugins/cordova-plugin-facebook4/plugins.xml
    change
    <framework src="com.facebook.android:facebook-android-sdk:$FACEBOOK_ANDROID_SDK_VERSION"/>
    to
    <framework src="build.gradle" custom="true" type="gradleReference"/>

  2. Add platform android and build

@Yawn2323
Copy link

Yawn2323 commented Oct 2, 2019

there is no build.gradle in facebook plugin tsk

@viking2917
Copy link

In case anyone needs the solution from @JustasKuizinas (thank you btw!), I created a fork with those changes in it. You can install it like this:

cordova plugin add https://github.com/viking2917/cordova-plugin-facebook4.git --save --variable APP_ID="xxxxxxx" --variable APP_NAME="xxxxx"

or, if you're using Ionic, then:
ionic cordova plugin add https://github.com/viking2917/cordova-plugin-facebook4.git --save --variable APP_ID="xxxxxxx" --variable APP_NAME="xxxxx"

@ocsi94
Copy link

ocsi94 commented Nov 29, 2019

There is an another solution, if you want to use the latest version.
You can use build-extras.gradle for exclude the zxing lib.
Create a file, paste this:
configurations { compile.exclude group: 'com.google.zxing' }
then add a line to the config.xml, at the android section :
<resource-file src="{{nameOfYourFile}}" target="app/build-extras.gradle" />

You can build your project now.

@nacho004
Copy link

nacho004 commented Mar 2, 2020

There is an another solution, if you want to use the latest version.
You can use build-extras.gradle for exclude the zxing lib.
Create a file, paste this:
configurations { compile.exclude group: 'com.google.zxing' }
then add a line to the config.xml, at the android section :
<resource-file src="{{nameOfYourFile}}" target="app/build-extras.gradle" />

You can build your project now.

This did the trick. Works for me

@quyenlt298
Copy link

quyenlt298 commented Sep 11, 2020

configurations { compile.exclude group: 'com.google.zxing' }

Thanh you. My issue is resolved by using your trick

@noahcooper
Copy link
Collaborator

noahcooper commented Jan 26, 2021

Along with all other Phonegap-maintained plugins, phonegap-plugin-barcodescanner is deprecated.

@ljudbane
Copy link

ljudbane commented Aug 12, 2022

There is an another solution, if you want to use the latest version. You can use build-extras.gradle for exclude the zxing lib. Create a file, paste this: configurations { compile.exclude group: 'com.google.zxing' } then add a line to the config.xml, at the android section : <resource-file src="{{nameOfYourFile}}" target="app/build-extras.gradle" />

You can build your project now.

This will no longer work in newer versions of gradle. I don't know specifics but build started failing once i upgraded cordova-android to 11.0.0. What worked for me was:

configurations.implementation {
    exclude group: 'com.google.zxing'
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests