Android Error: META-INF/DEPENDENCIES [How to Solve]

3 files found with path ‘META-INF/DEPENDENCIES’.
Adding a packagingOptions block may help, please refer to
https://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.PackagingOptions.html
for more information

Probably means: Error: Multiple files found in OS independent path ‘META-INF/DEPENDENCIES’
Solution:
Add to the build.gradle where the problem occurs

packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
}

The general principle is:

In Android gradle construction, it is not allowed to include the same file with the same path in the output multiple times. In your construction, there are two meta-inf/dependencies files from different places. Since your application does not need this file at all, the easiest way is to tell the construction system to ignore it completely, which is the role of the exclude instruction

Another PickFirst instruction tells the build system to keep one copy; There are some details in Android gradle plug-in 0.7.0: “duplicate files during APK packaging”

Read More: