android包重複問題

Neither_candidate發表於2017-06-15


問題:

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.

> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/rxjava.properties
File1: C:\Users\Administrator\.gradle\caches\modules-2\files-2.1\io.reactivex\rxjava\1.2.1\4e4cfa4adc74521d5966799fa5ab70b733552f68\rxjava-1.2.1.jar

File2: C:\Users\Administrator\.gradle\caches\modules-2\files-2.1\io.reactivex.rxjava2\rxjava\2.0.1\57f850a6b317e5582f1dbaff10a9e7d7e1fcdcfb\rxjava-2.0.1.jar


問題所在: 

META-INF/rxjava.properties



解決:

packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/rxjava.properties'
        exclude 'META-INF/rxjava.PROPERTIES'
        exclude 'META-INF/RXJAVA.properties'
        exclude 'META-INF/RXJAVA.PROPERTIES'
        exclude 'META-INF/rxjava'
        exclude 'META-INF/RXJAVA'
	//有其他重複的可以繼續設定
    }




相關文章