Android 删除aar包中的jar包解决Duplicate class包冲突问题

项目开发编译过程中报如下错误,排查后发现是因为

Duplicate class com.google.gson.DefaultDateTypeAdapter found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.ExclusionStrategy found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.FieldAttributes found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.FieldNamingPolicy found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.FieldNamingPolicy$1 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.FieldNamingPolicy$2 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.FieldNamingPolicy$3 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.FieldNamingPolicy$4 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.FieldNamingPolicy$5 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.FieldNamingStrategy found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.Gson found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.Gson$1 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.Gson$2 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.Gson$3 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.Gson$4 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.Gson$5 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.Gson$FutureTypeAdapter found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.GsonBuilder found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.InstanceCreator found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.JsonArray found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.JsonDeserializationContext found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.JsonDeserializer found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.JsonElement found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.JsonIOException found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.JsonNull found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.JsonObject found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.JsonParseException found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.JsonParser found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.JsonPrimitive found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.JsonSerializationContext found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.JsonSerializer found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.JsonStreamParser found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.JsonSyntaxException found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.LongSerializationPolicy found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.LongSerializationPolicy$1 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.LongSerializationPolicy$2 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.TypeAdapter found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.TypeAdapter$1 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.TypeAdapterFactory found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.annotations.Expose found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.annotations.SerializedName found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.annotations.Since found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.annotations.Until found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.$Gson$Preconditions found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.$Gson$Types found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.$Gson$Types$GenericArrayTypeImpl found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.$Gson$Types$ParameterizedTypeImpl found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.$Gson$Types$WildcardTypeImpl found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.ConstructorConstructor found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.ConstructorConstructor$1 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.ConstructorConstructor$10 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.ConstructorConstructor$11 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.ConstructorConstructor$12 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.ConstructorConstructor$2 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.ConstructorConstructor$3 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.ConstructorConstructor$4 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.ConstructorConstructor$5 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.ConstructorConstructor$6 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.ConstructorConstructor$7 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.ConstructorConstructor$8 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.ConstructorConstructor$9 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.Excluder found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.Excluder$1 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.JsonReaderInternalAccess found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.LazilyParsedNumber found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.LinkedTreeMap found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.LinkedTreeMap$1 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.LinkedTreeMap$EntrySet found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.LinkedTreeMap$EntrySet$1 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.LinkedTreeMap$KeySet found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.LinkedTreeMap$KeySet$1 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.LinkedTreeMap$LinkedTreeMapIterator found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.LinkedTreeMap$Node found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.ObjectConstructor found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.Primitives found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.Streams found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.Streams$AppendableWriter found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.Streams$AppendableWriter$CurrentWrite found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.UnsafeAllocator found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.UnsafeAllocator$1 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.UnsafeAllocator$2 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.UnsafeAllocator$3 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.UnsafeAllocator$4 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.ArrayTypeAdapter found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.ArrayTypeAdapter$1 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.CollectionTypeAdapterFactory found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.DateTypeAdapter found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.DateTypeAdapter$1 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.JsonTreeReader found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.JsonTreeReader$1 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.JsonTreeWriter found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.JsonTreeWriter$1 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.MapTypeAdapterFactory found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.ObjectTypeAdapter found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.ObjectTypeAdapter$1 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.ObjectTypeAdapter$2 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.ReflectiveTypeAdapterFactory found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$BoundField found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.SqlDateTypeAdapter found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.SqlDateTypeAdapter$1 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TimeTypeAdapter found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TimeTypeAdapter$1 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$1 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$10 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$11 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$12 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$13 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$14 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$15 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$16 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$17 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$18 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$19 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$2 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$20 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$21 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$22 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$23 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$24 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$25 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$26 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$27 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$28 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$29 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$3 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$30 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$31 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$32 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$4 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$5 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$6 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$7 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$8 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$9 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.internal.bind.TypeAdapters$EnumTypeAdapter found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.reflect.TypeToken found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.stream.JsonReader found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.stream.JsonReader$1 found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.stream.JsonScope found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.stream.JsonToken found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.stream.JsonWriter found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)
Duplicate class com.google.gson.stream.MalformedJsonException found in modules gson-2.2.4.jar (com.xindecoiot.xdreader:zebra-scanner:2.4.6) and gson-2.8.5.jar (com.google.code.gson:gson:2.8.5)

Go to the documentation to learn how to Fix dependency resolution errors.

排查后发现是因为重复引用了不同版本的gson包导致的包冲突,在引用的zebra-scanner这个包含包含了一个gson的jar包,导致了包冲突

dependencies {
    implementation 'com.xindecoiot.xdreader:zebra-scanner:2.4.6'
    implementation 'com.google.code.gson:gson:2.8.5'
}

由于zebra-scanner中的gson包版本比较低,我想要删除里面的jar,但是这个人家第三方的包,该如何删呢?

一种思路是找到这个aar包,然后解压把里面的gson的jar包删除,再重新打包。

但是上面这种方法稍显麻烦,而且我也未验证是否可行。

还有一种方法是在Android Studio中的External Libraries中展开相应的aar包,然后直接删除里面不要的jar包即可,这种方法亲测可行,而且简单快速。

Android 删除aar包中的jar包解决Duplicate class包冲突问题_第1张图片

你可能感兴趣的:(android)