集成adobeMobileLibrary-4.14.0.jar遇重复类错误,求解决方法
Hey, I’ve dealt with this exact duplicate class issue from Adobe Mobile Library before—super common when a pre-built .aar in your project includes an older version of the library alongside the adobeMobileLibrary-4.14.0.jar you’re trying to integrate. Here are the most reliable fixes:
1. Exclude the duplicate Adobe dependency from the conflicting AAR
If you’re using Gradle (which you almost certainly are for Android), you can explicitly exclude the Adobe library from the problematic .aar when declaring it in your app/build.gradle. Let’s say your AAR dependency looks like this:
implementation(name: 'your-conflicting-aar-file', ext: 'aar')
Modify it to add the exclusion rule:
implementation(name: 'your-conflicting-aar-file', ext: 'aar') { exclude group: 'com.adobe.mobile', module: 'adobeMobileLibrary' }
This tells Gradle to only use the 4.14.0 version you’ve added, and skip the one bundled inside the AAR.
2. Force a single version of Adobe Mobile Library across the entire project
If you’re not sure which dependency is bringing in the older version, or if multiple dependencies include it, you can enforce a universal version in your root build.gradle:
allprojects { configurations.all { resolutionStrategy { force 'com.adobe.mobile:adobeMobileLibrary:4.14.0' } } }
This overrides any other versions of the library that might be pulled in by dependencies, ensuring only your desired 4.14.0 version is used everywhere.
3. Replace the manual JAR with an official Gradle dependency
Instead of manually dropping the adobeMobileLibrary-4.14.0.jar into your libs folder, switch to the official Gradle dependency—it makes version management way easier:
implementation 'com.adobe.mobile:adobeMobileLibrary:4.14.0'
Pair this with the force version rule above, and you’ll eliminate any chance of duplicate JARs slipping in.
Verify the fix
To make sure the conflict is gone, run this command in your project root to check the dependency tree:
./gradlew app:dependencies # On macOS/Linux # Or for Windows: gradlew.bat app:dependencies
Search the output for adobeMobileLibrary—you should only see the 4.14.0 version listed. Then recompile your project, and the ZipException should be resolved.
内容的提问来源于stack exchange,提问作者Brandon Zamudio

