When a third-party AAR is introduced in development, the runtime has a problem with the compilation:
Multiple Dex files define Lcom/google/gson/internal/streams$appendablewriter$currentwrite;
Plainly is a Gson jar package conflict caused by the decompression software to see if this: Keith!!!
Idea One:
In the Build.gradle under App module, add:
android{ Repositories { Flatdir { dirs ' libs '}} }
When dependent:
Compile (name: ' barcode_scanner_library_v2.3.2.0 ', ext: ' aar ') {
Exclude group: ' Com.google.gson '
}
It doesn't work!
Idea two: repack This aar!!! of a third party
- "Pro-Test effective" Extract the Aar file with the decompression software, delete the duplicate jar package in Libs, then clean the project (must operate), run again!
- Create a new module project, copy the useful things extracted from the AAR into the new module, and then package the new module!
Reference, two-pack (Package) AAR Practical guide https://www.jianshu.com/p/3bad128bd106
Multiple Dex files define Lcom/google/gson/internal/streams$appendablewriter$currentwrite;