我有一个带有以下构造函数的类:
class Configuration @JvmOverloads constructor(val applicationId: String, typesToAutomaticallyLoad: List<AutoLoadableType>,
val isTestMode: Boolean = false, var userId: String? = null,
private var videoNetworks: List<MDNetwork> = MDNetwork.values().toMutableList(),
private var networks: List<MDAdNetwork> = MDNetwork.values().toMutableList(),
var loadingTimeoutMs: Long = 20000)
字符串
我的proguard文件:
-keep class mypackage.** {
<init>(...);
*;
}
型
与minify禁用我得到:
@JvmOverloads
public Configuration(@NotNull String applicationId, @NotNull List typesToAutomaticallyLoad, boolean isTestMode, @Nullable String userId, @NotNull List videoNetworks, @NotNull List networks) {
this(applicationId, typesToAutomaticallyLoad, isTestMode, userId, videoNetworks, networks, 0L, 64, (DefaultConstructorMarker)null);
}
@JvmOverloads
public Configuration(@NotNull String applicationId, @NotNull List typesToAutomaticallyLoad, boolean isTestMode, @Nullable String userId, @NotNull List videoNetworks) {
this(applicationId, typesToAutomaticallyLoad, isTestMode, userId, videoNetworks, (List)null, 0L, 96, (DefaultConstructorMarker)null);
}
@JvmOverloads
public Configuration(@NotNull String applicationId, @NotNull List typesToAutomaticallyLoad, boolean isTestMode, @Nullable String userId) {
this(applicationId, typesToAutomaticallyLoad, isTestMode, userId, (List)null, (List)null, 0L, 112, (DefaultConstructorMarker)null);
}
@JvmOverloads
public Configuration(@NotNull String applicationId, @NotNull List typesToAutomaticallyLoad, boolean isTestMode) {
this(applicationId, typesToAutomaticallyLoad, isTestMode, (String)null, (List)null, (List)null, 0L, 120, (DefaultConstructorMarker)null);
}
@JvmOverloads
public Configuration(@NotNull String applicationId, @NotNull List typesToAutomaticallyLoad) {
this(applicationId, typesToAutomaticallyLoad, false, (String)null, (List)null, (List)null, 0L, 124, (DefaultConstructorMarker)null);
}
型
如果minify使能,我得到:
@JvmOverloads
public Configuration(@NotNull String var1, @NotNull List var2, boolean var3, @Nullable String var4, @NotNull List var5, @NotNull List var6) {
this(var1, var2, var3, var4, var5, var6, 0L, 64, (DefaultConstructorMarker)null);
}
@JvmOverloads
public Configuration(@NotNull String var1, @NotNull List var2, boolean var3, @Nullable String var4, @NotNull List var5) {
this(var1, var2, var3, var4, var5, (List)null, 0L, 96, (DefaultConstructorMarker)null);
}
@JvmOverloads
public Configuration(@NotNull String var1, @NotNull List var2, boolean var3, @Nullable String var4) {
this(var1, var2, var3, var4, (List)null, (List)null, 0L, 112, (DefaultConstructorMarker)null);
}
@JvmOverloads
public Configuration(@NotNull String var1, @NotNull List var2, boolean var3) {
this(var1, var2, var3, (String)null, (List)null, (List)null, 0L, 120, (DefaultConstructorMarker)null);
}
@JvmOverloads
public Configuration(@NotNull String var1, @NotNull List var2) {
this(var1, var2, false, (String)null, (List)null, (List)null, 0L, 124, (DefaultConstructorMarker)null);
}
型
所以这个proguard配置保留了类名、构造函数名,但没有参数名。
如何让它也保留参数名?
2条答案
按热度按时间6tqwzwtp1#
您必须添加@SerializedName(“...”)和所有参数,
数据类SyncUser(@SerializedName(“user”)瓦尔user:User)
ukqbszuj2#
这都是关于Kotlin元数据的。我在这里建议两件事:
字符串