How to solve “Duplicate files copied in APK META-INF/LICENSE.txt”?

Standard

Sometimes depends on libraries that you have used in your Android project this annoying error shows up during gradle build using Android Studio:

Error:com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE.txt

can be solve this issue and many more by adding this to the Android tag of your build.grade file:

packagingOptions {
    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'
}

Leave a Reply

Your email address will not be published. Required fields are marked *