[英]ionic facebook and barcodescanner issue
我在使用Facebook插件和条形码扫描器时遇到问题,首先我创建了一个单独的项目来检查Facebook插件的工作方式并正常运行,但是当我将Facebook插件添加到我的项目中时,我使用条形码扫描器插件无法在android中运行该项目,出现以下异常:
BUILD FAILED
Total time: 10.111 secs
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/zxing/BarcodeFormat.class
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Error: cmd: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/zxing/BarcodeFormat.class
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
[ERROR] An error occurred while running cordova run android (exit code 1).
步骤1:安装条形码扫描器插件:
$ ionic cordova plugin add phonegap-plugin-barcodescanner
$ npm install --save @ionic-native/barcode-scanner
步骤2:安装Facebook插件:(使用下面的facebook插件版本)
ionic cordova plugin add cordova-plugin-facebook4@1.7.4 --variable APP_ID="****" --variable APP_NAME="****"
npm install --save @ionic-native/facebook
步骤3:从以下路径打开文件facebookconnect.xml
: yourapp\\platforms\\android\\app\\src\\main\\res\\values
然后在<resources></resources>
添加两行
<resources>
<string name="fb_app_id">***your_app_id***</string>
<string name="fb_app_name">***your_app_name***</string>
</resources>
第4步:命令: cordova clean
允许cordova清洁您的应用
第5步:命令: cordova build
-检查cordova构建您的应用
第6步:命令: ionic cordova build android
应用
更改所需的Facebook插件版本可以为我解决此问题。
ionic cordova plugin add cordova-plugin-facebook4@1.7.4 --variable APP_ID="" --variable APP_NAME=""
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.