在Android App上集成一个新的库时,我遇到了一个hudge问题。
当我尝试在Gradle (应用程序模块)和同步项目上使用implementation 'br.com.stone:stone-sdk:3.8.2'
时,安卓显示了一个新问题
Duplicate class org.xmlpull.v1.XmlPullParser found in modules jetified-ksoap2-android-assembly-3.0.0-jar-with-dependencies.jar (ksoap2-android-assembly-3.0.0-jar-with-dependencies.jar) and jetified-xpp3_min-1.1.4c.jar (xpp3:xpp3_min:1.1.4c)
Duplicate class org.xmlpull.v1.XmlPullParserException found in modules jetified-ksoap2-android-assembly-3.0.0-jar-with-dependencies.jar (ksoap2-android-assembly-3.0.0-jar-with-dependencies.jar) and jetified-xpp3_min-1.1.4c.jar (xpp3:xpp3_min:1.1.4c)
也许实现files('libs/ksoap2-android-assembly-3.0.0-jar-with-dependencies.jar')已经有了相同的类。
没有人能帮我解决这个问题吗?
发布于 2021-01-20 19:29:50
我基于https://github.com/flutter/flutter/issues/59341发布了这个答案以供参考。你需要做的就是在app/build.gradle中添加3项:
#1
shrinkResources错误
minifyEnabled false
#2
配置{ all*.exclude组:'xpp3',模块:'xpp3‘}
#3
实现'xmlpull:xmlpull:1.1.3.4d_b4_min‘
PS:我用这个解决方案解决了一个类似的问题(只是用第二项中的"xpp3“替换为"xmlpull”):
任务':app:checkDebugDuplicateClasses‘的
执行失败。执行模块jetified-kxml2-2.3.0 (net.sf.kxml:kxml2:2.3.0)和jetified-xmlpull 1.1.3.4d_b4_min (xmlpull:xmlpull:1.1.3.4d_b4_min)中发现的com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable重复类org.xmlpull.v1.XmlPullParserException时出错。和jetified-.0-1.1.3.4d_b4_min (xmlpull:xmlpull:1.1.3.4d_b4_min)
https://stackoverflow.com/questions/65306966
复制相似问题