2
votes

When I add compile group: 'com.google.cloud', name: 'google-cloud-storage', version: '0.8.0-beta' it shows an error when I run the app

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

I added excluding the META INF files

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

Tried https://github.com/GoogleCloudPlatform/google-cloud-java#quickstart, same issue

Any solutions?

2

2 Answers

0
votes

Solution

Downloaded jar files from maven and added them to lib folder

  • google-api-services-storage-v1-rev92-1.22.0.jar
  • google-cloud-0.8.0.jar
  • google-cloud-core-0.8.0.jar
  • google-cloud-storage-0.8.0-beta.jar

And excluded duplicated files in app build.gradle

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

You may encounter the emergence of duplicates on the cloud storage. If this happens, you can use the service to identify and delete duplicates. http://alternativeto.net/software/duplicate-file-finder-and-remover/