DuplicateFileException为android

时间:2017-06-28 06:19:01

标签: cordova ionic-framework ionic2 instabug

我正在尝试为Android构建我的应用程序,自从我将android-cordova更新为6.2.3后,我无法再为Android构建我的应用程序。

回滚到android-cordova 6.1.1没有帮助,我在上一次升级后无法再次构建。

完整错误是

* What went wrong:
Execution failed for task ':transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate file
s copied in APK META-INF/rxjava.properties
        File1: /Users/admin/Desktop/Gravity/clubezy-meteorionic/platforms/android/build/intermediates/exploded-aar/com.goo
gle.android.gms/play-services-basement/11.0.0/jars/classes.jar
        File2: /Users/admin/.gradle/caches/modules-2/files-2.1/io.reactivex/rxjava/1.1.9/e4362e62f1ba92e360b197d6d7ffae67e
5ecae9a/rxjava-1.1.9.jar

我怀疑这可能是我的一个cordova插件可能导致此问题。

这是我的环境和插件。

ionic info: 
global packages:

@ionic/cli-utils : 1.4.0 
Cordova CLI : 7.0.1 
Ionic CLI : 3.4.0

local packages:

@ionic/app-scripts : 1.3.7 
@ionic/cli-plugin-cordova : 1.4.0 
@ionic/cli-plugin-ionic-angular : 1.3.1 
Cordova Platforms : ios 4.4.0, android 6.2.3
Ionic Framework : ionic-angular 3.4.2

System:

Node : v6.10.3 
OS : Linux 4.4 
Xcode : not installed 
ios-deploy : not installed 
ios-sim : not installed 
npm : 5.0.3

cordova plugin ls

com.instabug.cordova.plugin 1.0.0 "instabug-cordova" 
cordova-plugin-3dtouch 1.3.5 "3D Touch" 
cordova-plugin-app-version 0.1.9 "AppVersion" 
cordova-plugin-camera 2.3.1 "Camera" 
cordova-plugin-compat 1.1.0 "Compat" 
cordova-plugin-console 1.0.5 "Console" 
cordova-plugin-device 1.1.6 "Device" 
cordova-plugin-file 4.3.3 "File" 
cordova-plugin-file-transfer 1.6.3 "File Transfer" 
cordova-plugin-multidex 0.1.1 "Cordova Multi Dex" 
cordova-plugin-splashscreen 4.0.3 "Splashscreen" 
cordova-plugin-statusbar 2.2.3 "StatusBar" 
cordova-plugin-whitelist 1.3.1 "Whitelist" 
ionic-plugin-keyboard 2.2.1 "Keyboard" 
onesignal-cordova-plugin 2.0.11 "OneSignal Push Notifications"

我认为可能导致这个问题的插件就是一个插件。

〜修改

一次添加一个插件

com.instabug.cordova.plugincordova-plugin-multidex

导致它

multidex是instabug的依赖

2 个答案:

答案 0 :(得分:0)

    @ionic/cli-utils : 1.4.0
    Cordova CLI      : 7.0.1
    Ionic CLI        : 3.4.0

local packages:

    @ionic/app-scripts              : 1.3.7
    @ionic/cli-plugin-cordova       : 1.4.0
    @ionic/cli-plugin-ionic-angular : 1.3.1
    Cordova Platforms               : android 6.2.3
    Ionic Framework                 : ionic-angular 3.4.2

System:

    Node       : v8.1.1
    OS         : Windows 10
    Xcode      : not installed
    ios-deploy : not installed
    ios-sim    : not installed
    npm        : 5.0.3

com.instabug.cordova.plugin 1.0.0 "instabug-cordova"
cordova-plugin-3dtouch 1.3.5 "3D Touch"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-camera 2.4.1 "Camera"
cordova-plugin-compat 1.1.0 "Compat"
cordova-plugin-console 1.0.7 "Console"
cordova-plugin-device 1.1.6 "Device"
cordova-plugin-file 4.3.3 "File"
cordova-plugin-file-transfer 1.6.3 "File Transfer"
cordova-plugin-multidex 0.1.1 "Cordova Multi Dex"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-statusbar 2.2.3 "StatusBar"
cordova-plugin-whitelist 1.3.2 "Whitelist"
ionic-plugin-keyboard 2.2.1 "Keyboard"
onesignal-cordova-plugin 2.1.2 "OneSignal Push Notifications"

在我的Windows机器上构建,我已经更新了我的插件,环境是一样的,我不再收到上面的错误。不确定是什么导致了冲突,所以不是真正的答案。

答案 1 :(得分:0)

为了让它在我的iOS和Linux构建机器上构建,我更改了public class Model { private boolean isSelected; private String animal; public String getAnimal() { return animal; } public void setAnimal(String animal) { this.animal = animal; } public boolean getSelected() { return isSelected; } public void setSelected(boolean selected) { isSelected = selected; } } 以获得此功能。

build.gradle

它现在似乎正在构建正确,我创建了一个带有更改的分支,因此我可以从github将其从包中安装。