Android Google云端存储重复文件

时间:2017-01-10 12:14:57

标签: android google-app-engine google-cloud-storage

当我添加compile group: 'com.google.cloud', name: 'google-cloud-storage', version: '0.8.0-beta'时,它会在我运行应用时显示错误

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForProductionDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/INDEX.LIST
    File1: /.gradle/caches/modules-2/files-2.1/com.google.cloud/google-cloud-storage/0.8.0-beta/92c10417dd9ef400564414c243eecdd0a7f51963/google-cloud-storage-0.8.0-beta.jar
    File2: /.gradle/caches/modules-2/files-2.1/com.google.cloud/google-cloud-core/0.8.0/5fe7f10ded15149a5fc633d98adbacf11b00907f/google-cloud-core-0.8.0.jar

我添加了排除META INF文件

packagingOptions {     排除'META-INF / MANIFEST.MF'     排除'META-INF / ASL2.0'     排除'META-INF / DEPENDENCIES.txt'     排除'META-INF / LICENSE.txt'     排除'META-INF / NOTICE.txt'     排除'META-INF / NOTICE'     排除'META-INF / LICENSE'     排除'META-INF / DEPENDENCIES'     排除'META-INF / notice.txt'     排除'META-INF / license.txt'     排除'META-INF / dependencies.txt'     排除'META-INF / LGPL2.1' }

尝试https://github.com/GoogleCloudPlatform/google-cloud-java#quickstart,同样的问题

任何解决方案?

2 个答案:

答案 0 :(得分:0)

<强>解决方案

从maven下载jar文件并将它们添加到lib文件夹

  • 谷歌-API服务存储-V1-rev92-1.22.0.jar
  • 谷歌云0.8.0.jar
  • 谷歌云的芯 - 0.8.0.jar
  • google-cloud-storage-0.8.0-beta.jar

并在app build.gradle中排除重复的文件

packagingOptions {
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/io.netty.versions.properties'
    exclude 'META-INF/INDEX.LIST'
}

答案 1 :(得分:0)

您可能会在云存储上遇到重复项的出现。 如果发生这种情况,您可以使用该服务来识别和删除重复项。 http://alternativeto.net/software/duplicate-file-finder-and-remover/