在模块 jetified-com.google.zxing.client.android.captureactivity.jar 和 jetified-core-3.3.3.jar 中发现重复 class com.google.zxing.Binarizer
Duplicate class com.google.zxing.Binarizer found in modules jetified-com.google.zxing.client.android.captureactivity.jar and jetified-core-3.3.3.jar
所以我尝试了 运行 ionic cordova run android
但我发现构建失败并出现异常。
Duplicate class com.google.zxing.Binarizer found in modules jetified-com.google.zxing.client.android.captureactivity.jar (com.google.zxing.client.android.captureactivity.jar) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
Duplicate class com.google.zxing.BinaryBitmap found in modules jetified-com.google.zxing.client.android.captureactivity.jar (com.google.zxing.client.android.captureactivity.jar) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
Duplicate class com.google.zxing.ChecksumException found in modules jetified-com.google.zxing.client.android.captureactivity.jar (com.google.zxing.client.android.captureactivity.jar) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
Duplicate class com.google.zxing.DecodeHintType found in modules jetified-com.google.zxing.client.android.captureactivity.jar (com.google.zxing.client.android.captureactivity.jar) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
Duplicate class com.google.zxing.EncodeHintType found in modules jetified-com.google.zxing.client.android.captureactivity.jar (com.google.zxing.client.android.captureactivity.jar) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
Duplicate class com.google.zxing.FormatException found in modules jetified-com.google.zxing.client.android.captureactivity.jar (com.google.zxing.client.android.captureactivity.jar) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
Duplicate class com.google.zxing.LuminanceSource found in modules jetified-com.google.zxing.client.android.captureactivity.jar (com.google.zxing.client.android.captureactivity.jar) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
Duplicate class com.google.zxing.MultiFormatReader found in modules jetified-com.google.zxing.client.android.captureactivity.jar (com.google.zxing.client.android.captureactivity.jar) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
Duplicate class com.google.zxing.MultiFormatWriter found in modules jetified-com.google.zxing.client.android.captureactivity.jar (com.google.zxing.client.android.captureactivity.jar) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
Duplicate class com.google.zxing.MultiFormatWriter found in modules jetified-com.google.zxing.client.android.captureactivity.jar (com.google.zxing.client.android.captureactivity.jar) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
Duplicate class com.google.zxing.NotFoundException found in modules jetified-com.google.zxing.client.android.captureactivity.jar (com.google.zxing.client.android.captureactivity.jar) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
Duplicate class com.google.zxing.PlanarYUVLuminanceSource found in modules jetified-com.google.zxing.client.android.captureactivity.jar (com.google.zxing.client.android.captureactivity.jar) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
Duplicate class com.google.zxing.RGBLuminanceSource found in modules jetified-com.google.zxing.client.android.captureactivity.jar (com.google.zxing.client.android.captureactivity.jar) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
Duplicate class com.google.zxing.Reader found in modules jetified-com.google.zxing.client.android.captureactivity.jar (com.google.zxing.client.android.captureactivity.jar) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
列表继续并以:
结尾
Duplicate class com.google.zxing.qrcode.encoder.QRCode found in modules jetified-com.google.zxing.client.android.captureactivity.jar (com.google.zxing.client.android.captureactivity.jar) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
Go to the documentation to learn how to Fix dependency
resolution errors.
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it
incompatible with Gradle 7.0. Use '--warning-mode all' to show the
individual deprecation warnings. See
https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings
这是我的 build.gradle 文件:
buildscript {
ext.kotlin_version = '1.3.50'
apply from: 'repositories.gradle'
repositories repos
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
apply from: 'repositories.gradle'
repositories repos
project.ext {
defaultBuildToolsVersion="29.0.2" //String
defaultMinSdkVersion=22 //Integer - Minimum requirement is Android 5.1
defaultTargetSdkVersion=29 //Integer - We ALWAYS target the latest by default
defaultCompileSdkVersion=29 //Integer - We ALWAYS compile with the latest by default
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我试过了:
- 添加:
configurations {compile.exclude group: 'com.google.zxing'}
到 build.gradle
- 从 cordova 中删除了 android 平台,然后又添加了它。
- 删除了 barcodescanner 插件然后添加它。
我已经坚持了将近一个星期了。
问题是由于facebook4插件和barcodeScanner插件之间的冲突造成的。两者都使用名为 ZXing 的库,这会导致冲突。
简单的解决方法(很难找到)是删除 facebook 插件并添加没有 zxing 库的相同插件。
ionic cordova platform rm android
ionic cordova plugin rm cordova-plugin-facebook4 --save --variable APP_ID="ID" --variable APP_NAME="NAME"
ionic cordova plugin add https://github.com/AndreiTelteu/cordova-plugin-facebook4-no-zxing --save --variable APP_ID="ID" --variable APP_NAME="NAME"
ionic cordova platform add android
ionic cordova platform rm android
这解决了我的问题。请注意,您的代码中没有可编辑的内容。
查看 git 存储库以获取更多信息:https://github.com/AndreiTelteu/cordova-plugin-facebook4-no-zxing
所以我尝试了 运行 ionic cordova run android
但我发现构建失败并出现异常。
Duplicate class com.google.zxing.Binarizer found in modules jetified-com.google.zxing.client.android.captureactivity.jar (com.google.zxing.client.android.captureactivity.jar) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3) Duplicate class com.google.zxing.BinaryBitmap found in modules jetified-com.google.zxing.client.android.captureactivity.jar (com.google.zxing.client.android.captureactivity.jar) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3) Duplicate class com.google.zxing.ChecksumException found in modules jetified-com.google.zxing.client.android.captureactivity.jar (com.google.zxing.client.android.captureactivity.jar) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3) Duplicate class com.google.zxing.DecodeHintType found in modules jetified-com.google.zxing.client.android.captureactivity.jar (com.google.zxing.client.android.captureactivity.jar) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3) Duplicate class com.google.zxing.EncodeHintType found in modules jetified-com.google.zxing.client.android.captureactivity.jar (com.google.zxing.client.android.captureactivity.jar) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3) Duplicate class com.google.zxing.FormatException found in modules jetified-com.google.zxing.client.android.captureactivity.jar (com.google.zxing.client.android.captureactivity.jar) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3) Duplicate class com.google.zxing.LuminanceSource found in modules jetified-com.google.zxing.client.android.captureactivity.jar (com.google.zxing.client.android.captureactivity.jar) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3) Duplicate class com.google.zxing.MultiFormatReader found in modules jetified-com.google.zxing.client.android.captureactivity.jar (com.google.zxing.client.android.captureactivity.jar) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3) Duplicate class com.google.zxing.MultiFormatWriter found in modules jetified-com.google.zxing.client.android.captureactivity.jar (com.google.zxing.client.android.captureactivity.jar) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3) Duplicate class com.google.zxing.MultiFormatWriter found in modules jetified-com.google.zxing.client.android.captureactivity.jar (com.google.zxing.client.android.captureactivity.jar) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3) Duplicate class com.google.zxing.NotFoundException found in modules jetified-com.google.zxing.client.android.captureactivity.jar (com.google.zxing.client.android.captureactivity.jar) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3) Duplicate class com.google.zxing.PlanarYUVLuminanceSource found in modules jetified-com.google.zxing.client.android.captureactivity.jar (com.google.zxing.client.android.captureactivity.jar) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3) Duplicate class com.google.zxing.RGBLuminanceSource found in modules jetified-com.google.zxing.client.android.captureactivity.jar (com.google.zxing.client.android.captureactivity.jar) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3) Duplicate class com.google.zxing.Reader found in modules jetified-com.google.zxing.client.android.captureactivity.jar (com.google.zxing.client.android.captureactivity.jar) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
列表继续并以:
结尾Duplicate class com.google.zxing.qrcode.encoder.QRCode found in modules jetified-com.google.zxing.client.android.captureactivity.jar (com.google.zxing.client.android.captureactivity.jar) and jetified-core-3.3.3.jar (com.google.zxing:core:3.3.3)
Go to the documentation to learn how to Fix dependency resolution errors.
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings
这是我的 build.gradle 文件:
buildscript {
ext.kotlin_version = '1.3.50'
apply from: 'repositories.gradle'
repositories repos
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
apply from: 'repositories.gradle'
repositories repos
project.ext {
defaultBuildToolsVersion="29.0.2" //String
defaultMinSdkVersion=22 //Integer - Minimum requirement is Android 5.1
defaultTargetSdkVersion=29 //Integer - We ALWAYS target the latest by default
defaultCompileSdkVersion=29 //Integer - We ALWAYS compile with the latest by default
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我试过了:
- 添加:
configurations {compile.exclude group: 'com.google.zxing'}
到 build.gradle - 从 cordova 中删除了 android 平台,然后又添加了它。
- 删除了 barcodescanner 插件然后添加它。
我已经坚持了将近一个星期了。
问题是由于facebook4插件和barcodeScanner插件之间的冲突造成的。两者都使用名为 ZXing 的库,这会导致冲突。
简单的解决方法(很难找到)是删除 facebook 插件并添加没有 zxing 库的相同插件。
ionic cordova platform rm android
ionic cordova plugin rm cordova-plugin-facebook4 --save --variable APP_ID="ID" --variable APP_NAME="NAME"
ionic cordova plugin add https://github.com/AndreiTelteu/cordova-plugin-facebook4-no-zxing --save --variable APP_ID="ID" --variable APP_NAME="NAME"
ionic cordova platform add android
ionic cordova platform rm android
这解决了我的问题。请注意,您的代码中没有可编辑的内容。
查看 git 存储库以获取更多信息:https://github.com/AndreiTelteu/cordova-plugin-facebook4-no-zxing