我有包含 RootTools.jar 的 android 项目,它运行没有任何问题,但是当我按照本指南添加 OneSignal SDk 时: Android SDK Installation (Android Studio)尝试运行它时出现错误:
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/stericson/RootTools/internal/RootToolsInternalMethods.class
我试图调试它并得到了这个:
10:36:07.391 [调试] [com.android.build.gradle.internal.transforms.JarMerger] addJar(C:\Apps\SatpolApp\app\build\intermediates\exploded-aar\com.onesignal\OneSignal\2.1. 2\jars\classes.jar):入口com/onesignal/TrackGooglePurchase.class
10:36:07.399 [调试] [com.android.build.gradle.internal.transforms.JarMerger] 广告 dJar(C:\Apps\SatpolApp\app\build\intermediates\exploded-aar\com.onesignal\OneSignal\2.1 .2\jars\classes.jar):入口com/stericson/RootTools/internal/RootToolsInternalMethods.class
10:36:08.363 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] 完成执行任务':app:transformClassesWithJarMergingForDebug'
10:36:08.370 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :app:transformCl assesWithJarMergingForDebug 失败
所以我发现 OneSignal jar 有 com/stericson/RootTools/internal/RootToolsInternalMethods.class 导致重复输入错误,因为我已经包含了 RootTools.jar。
我想问的是如何从 OneSignal jar 中排除“com/stericson/RootTools/internal/RootToolsInternalMethods.class”,同时保持其正常运行?