1

我将 Proguard 与 TinyLog 一起使用。以下是在 proguard.conf 文件中定义的,如Tinylog 主页上所述

-keepnames interface org.tinylog.**
-keepnames class * implements org.tinylog.**
-keepclassmembers class * implements org.tinylog.** { <init>(...); }

以下错误消息来自混淆过程:

[proguard] Note: there were 1 duplicate class definitions.
[proguard]       (http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)
[proguard] Warning: there were 2 classes in incorrectly named files.
[proguard]          You should make sure all file names correspond to their class names.
[proguard]          The directory hierarchies must correspond to the package hierarchies.
[proguard]          (http://proguard.sourceforge.net/manual/troubleshooting.html#unexpectedclass)
[proguard]          If you don't mind the mentioned classes not being written out,
[proguard]          you could try your luck using the '-ignorewarnings' option.
[proguard] Error: Please correct the above warnings first. 

有谁知道如何纠正错误?

我正在使用 tinylog 2.4.1

在 proguard.conf 中使用 -ignorewarnings 不是一种选择

4

1 回答 1

0

这是一个最小的 Android 应用示例项目,它使用 tinylog 2 进行日志记录,使用 ProGuard 进行混淆:https ://github.com/tinylog-org/tinylog-android-example 。Gradle 的最新稳定版 Android 构建工具 (com.android.tools.build:gradle:7.1.0) 不会输出发布的警告。

如果您必须在 Gradle 脚本中使用旧版本的 ProGuard 或自定义 ProGuardTask,您可以删除模块信息文件,如下所述:META-INF/version duplicate error when using Proguard

于 2022-02-01T12:10:59.937 回答