Duplicate files copied in APK META-INF/LICENSE

This is a common nightmare in android. The licenses have the same filenames, so you can’t include them all; but if you exclude them some people could claim that you violate the agreements by doing so.

Imho, you can include the licenses, if needed, in your activities without actually copying the text files to the .apk file, so excluding the licenses from the build is pretty much okay.

In any case, if you just experimenting you can solve this error by adding the following to your build.gradle (module) file:

android {
    ...
    ...
    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'  
        exclude 'META-INF/ASL2.0'
    }     ... 
}

 

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s