SoFunction
Updated on 2025-04-10

The problem of Android repeatedly referring to multiple scenarios to report errors

1. The same dependency is different version

Solution:

 { details ->
            if ( == ''
                    && !('multidex')) {
                 "$supportlib_version"
            }
        }

2. The same Jar library conflicts and references multiple times

Solution:

If both the app module and submodule contain jar libraries, just delete the jar file repeatedly referenced under APP/libs.

3. There is another case where different Jar packages contain the same file (the path is also the same), which is the duplicate files error

The error message is similar:

Error:duplicate files during packaging of APK xxxx\
    Path in archive: META-INF/
    Origin 1: xxx\
    Origin 2: xxx\
You can ignore those files in your :
    android {
      packagingOptions {
        exclude 'META-INF/'
      }
    }

You can see in the prompt that the solution is given, just use the exclude statement configured by packagingOptions to delete duplicate files, such as:

Solution:

packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/'
    }

4. Different libraries introduce the same module

As follows: Use exclude to exclude duplicate gson library

Solution:

dependencies {
  api (':xx:1.0') {
      exclude group:'', module: 'gson'
  }
}

Repeated references to files (the same so file is referenced in the aar dependency library in multiple submodules)

In app/, for repeated referenced so files, use pickFirst and just select the first one.

Solution:

android{
        pickFirst 'lib/armeabi/'
}

This is the article about solving the problem of Android re-quoting errors in multiple scenarios. For more related Android re-quoting content, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!