[英]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.