以前不错的cordova应用现在无法编译,并出现以下错误和变化(总是重复com / google / android / gms / ...一些...的条目)
:app:transformClassesWithJarMergingForRelease FAILED
FAILURE: Build failed with an exception.
* What went wrong: Execution failed for task
':app:transformClassesWithJarMergingForRelease'.
com.android.build.api.transform.TransformException: java.util.zip.
ZipException: duplicate entry:
com/google/android/gms/tagmanager/Container$FunctionCallMacroCallback.class
在这里,我还研究了许多其他类似错误的情况,以及适用于其他情况的解决方案:
<plugin name="cordova-android-support-gradle-release" spec="^2.0.1"> <variable name="ANDROID_SUPPORT_VERSION" value="24.1.1" />
dependencies { implementation fileTree(dir: 'libs', include: '*.jar') // SUB-PROJECT DEPENDENCIES START implementation(project(path: ":CordovaLib")) compile "com.google.android.gms:play-services-analytics:11.0.1" compile "com.android.support:support-v4:24.1.1+" // SUB-PROJECT DEPENDENCIES END }
minSdkVersion 19 targetSdkVersion 28 multiDexEnabled true
cordova-launch-review 2.0.2 "Launch Review" cordova-plugin-compat 1.2.0 "Compat" cordova-plugin-device 2.0.2 "Device" cordova-plugin-dialogs 1.3.4 "Notification" cordova-plugin-file 6.0.1 "File" cordova-plugin-globalization 1.11.0 "Globalization" cordova-plugin-google-analytics 1.8.6 "Google Universal Analytics Plugin" cordova-plugin-googleplayservices 19.0.3 "Google Play Services for Android" cordova-plugin-inappbrowser 3.0.0 "InAppBrowser" cordova-plugin-splashscreen 5.0.3-dev "Splashscreen" cordova-plugin-statusbar 2.4.2 "StatusBar" cordova-plugin-whitelist 1.3.3 "Whitelist" cordova-plugin-x-socialsharing 5.4.4 "SocialSharing" es6-promise-plugin 4.2.2 "Promise"
我想念Ada Lovelace的名字是什么吗??
更新编辑:
我从/ platforms / android目录中运行./gradlew:app:dependencies并得到了这个信息:
+--- com.google.android.gms:play-services-analytics:11.0.1
| +--- com.google.android.gms:play-services-analytics-impl:[11.0.1] -> 11.0.1
| | +--- com.google.android.gms:play-services-base:[11.0.1] -> 11.0.1
| | | +--- com.google.android.gms:play-services-basement:[11.0.1] -> 11.0.1
| | | | \--- com.android.support:support-v4:25.2.0 -> 24.1.1
| | | | \--- com.android.support:support-annotations:24.1.1
| | | \--- com.google.android.gms:play-services-tasks:[11.0.1] -> 11.0.1
| | | \--- com.google.android.gms:play-services-basement:[11.0.1] -> 11.0.1 (*)
| | \--- com.google.android.gms:play-services-basement:[11.0.1] -> 11.0.1 (*)
| +--- com.google.android.gms:play-services-base:[11.0.1] -> 11.0.1 (*)
| +--- com.google.android.gms:play-services-basement:[11.0.1] -> 11.0.1 (*)
| \--- com.google.android.gms:play-services-tagmanager-v4-impl:[11.0.1] -> 11.0.1
| +--- com.google.android.gms:play-services-analytics-impl:[11.0.1] -> 11.0.1 (*)
| +--- com.google.android.gms:play-services-base:[11.0.1] -> 11.0.1 (*)
| \--- com.google.android.gms:play-services-basement:[11.0.1] -> 11.0.1 (*)
+--- com.android.support:support-v4:24.1.1+ -> 24.1.1 (*)
\--- project :CordovaLib
我的/ platforms / android / app / libs目录中唯一的库是: google-play-services.jar
答案 0 :(得分:1)
答案是众所周知的Dan Wilson针对Cordova的Google Analytics(分析)插件与Android不兼容
重要说明如果该插件的最新版本(0.8.0+)不是 在Cordova 5.0+上使用Android为您工作,请尝试 Issues 123中的建议。 Google Play服务一直非常 令人困惑的集成,但是最近几个月它已经简化了。 该插件使用新的更简单的方式(包括它作为框架) 而不是捆绑它可能与其他插件捆绑冲突 它),但是如果您以前安装了此插件,则某些旧文件可能会 仍然挥之不去。
修复as outlined here是为了安装Android支持存储库(已完成),以及更新Google Play服务和Google存储库(已完成),并且:
从/ platforms / android / app / libs删除Google服务jar
解决了。 @ Jon-Goodwin我恢复了线路
cordova.system.library.2=com.android.support:support-v4:24.1.1+
到/platforms/android/app/project.properties文件并成功编译,因此删除jar文件似乎已消除了冲突。如果google-play-services.jar文件来自/ platforms / android / app / libs,则该应用程序似乎可以在不使用它的情况下编译和运行。