In my gradle file, I have the following:
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
}
According to the documentation:
/**
* Adds an excluded paths.
* @param path the path, as packaged in the APK
*/
What does this mean? Could someone give me a real life example of why these exclusions would need to be made?
merges. The list of patterns where all occurrences are concatenated and packaged in the APK.
Android Studio uses Gradle, an advanced build toolkit, to automate and manage the build process, while allowing you to define flexible custom build configurations. Each build configuration can define its own set of code and resources, while reusing the parts common to all versions of your app.
When Gradle is unable to communicate with the Gradle daemon process, the build will immediately fail with a message similar to this: $ gradle help Starting a Gradle Daemon, 1 stopped Daemon could not be reused, use --status for details FAILURE: Build failed with an exception.
applicationId– This is used for identifying unique id for publishing of the app. minSdkVersion– This defines the minimum API level required to run the application. targetSdkVersion– This defines the API level used to test the app. versionCode– This defines the version code of the app.
If you were to change the extension of a few aar
files to zip
and open them eventually you will have two aar
files with files that with the same path.
SomeDependency-A.aar
-META-INF/LICENSE
...
SomeDependency-B.aar
-META-INF/LICENSE
...
When the aar
dependencies are merged it fails because it tries to add the file LICENSE
and it already exists.
We resolve this by excluding the duplicated files
android {
packagingOptions {
exclude 'META-INF/LICENSE'
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With