将模块添加到我的Android应用程序时获取DuplicateFileException

时间:2017-08-25 21:23:37

标签: java android gradle mqtt

我正在尝试将Paho MQTT服务(和客户端)添加到我的Android应用中,但在运行我的应用时,我遇到了$i = array_search($_GET["exampleQueryString"], (array)$exampleVariable); 运行时异常。

显示对我说一切都设置正确,当我清理/构建时,我根本没有错误。

我的应用 build.gradle 文件如下所示:

com.android.builder.packaging.DuplicateFileException

然而,当我跑步时,我收到dependencies { compile fileTree(dir: '../org.eclipse.paho.android/service/libs', excludes: ["org.eclipse.paho.client.mqttv3-1.1.0.jar"], include: '') compile fileTree(include: ['*.jar'], dir: 'libs', excludes: ["*org.eclipse.paho.client.mqttv3-1.1.0.jar"]) compile (project(':org.eclipse.paho.android.service')){ // exclude module: "org.eclipse.paho.client.mqttv3" transitive=true } // Uncommenting the below (when commenting out the above) WORKS. // However, I need to be able to alter the source, to I do need to be able // to import the Paho MQTT service as a module to my app. // compile 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.1.0' // compile 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1' ... 例外:

DuplicateFileException

我的文件层次结构如下:

enter image description here

对我来说似乎没问题。

有没有人对如何解决这个问题有任何指示?该错误声称* What went wrong: Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'. > com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK org/eclipse/paho/client/mqttv3/internal/nls/messages_zh_TW.properties File1: /Users/me/.gradle/caches/modules-2/files-2.1/org.eclipse.paho/org.eclipse.paho.client.mqttv3/1.1.0/89d827ffa47c241f2627421ef1d6c7a8c207a341/org.eclipse.paho.client.mqttv3-1.1.0.jar File2: /Users/me/myapp/code/myapp-android/org.eclipse.paho.android.service/build/intermediates/bundles/default/classes.jar org.eclipse.paho.client.mqttv3-1.1.0.jar发生冲突,但我的gradle文件明确排除了classes.jar的编译(或者我认为它的编译)。

我在这里不知所措;任何指针都欢迎。

1 个答案:

答案 0 :(得分:2)

这是因为您的两个依赖项正在使用Eclipse Paho MQTT库。

以下应解决问题

将以下内容添加到您的应用级抓点文件

 Exception in thread "main" AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server
 faultSubcode: 
 faultString: [QuotaCheckError.DEVELOPER_TOKEN_NOT_APPROVED @ ; trigger:'<null>']
 faultActor: 
 faultNode: 
 faultDetail: 
    https://adwords.google.com/api/adwords/cm/v201710}ApiExceptionFault:<message>[QuotaCheckError.DEVELOPER_TOKEN_NOT_APPROVED @ ; trigger:'&lt;null&gt;']</message><ApplicationException.Type>ApiException</ApplicationException.Type><errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="QuotaCheckError"><fieldPath/><trigger>&lt;null&gt;</trigger><errorString>QuotaCheckError.DEVELOPER_TOKEN_NOT_APPROVED</errorString><ApiError.Type>QuotaCheckError</ApiError.Type><reason>DEVELOPER_TOKEN_NOT_APPROVED</reason></errors>