Excluding dependencies in Gradle

This is the way that use to exclude some transitive dependency.

When come to project type dependency this is the way.

Keep in mind the additional brackets around  project(project(':library:view_pager_indicator'))

Android – Fix for Duplicate files copied in APK

If you are an android developer you may already familiar with this issue.

Usually you’re getting this for some text files or license files like  META-INF/notice.txt ,  META-INF/license.txt ,  META-INF/ASL2.0

In such scenarios we can exclude those files from APK packaging without any hesitation because we definitely know those will not affect our application functionality. We can do so using gradle  packagingOptions .

What can we do when we get like



We cannot exclude those files since they required for app functionality. So we need another way to handle such scenarios.

We can use  pickFirst in  packagingOptions to avoid duplicate file copying to APK as below.