gpt4 book ai didi

android - 生成用于代码分发的混淆 JAR

转载 作者:太空宇宙 更新时间:2023-11-03 11:13:50 26 4
gpt4 key购买 nike

我正在开发一个 Android 库项目。我想将此库作为 JAR 分发给其他开发人员。在分发 JAR 之前,我想对其进行混淆处理。我已经尝试为此目的使用 PROGUARD,但它在最后一步失败并说

输出 jar 是空的。您是否指定了正确的“-keep”选项?

谁能告诉我哪里出了问题?

=================编辑:错误日志=======================

ProGuard, version 4.7
Reading program jar [C:\Users\XYZ\Downloads\login.jar]
Reading library jar [D:\Softwares\Android SDK\adt-bundle-windows-x86-20130522\sdk\platforms\android-8\android.jar]
Note: the configuration refers to the unknown class 'javax.swing.plaf.ComponentUI'
Note: the configuration refers to the unknown class 'javax.swing.plaf.ComponentUI'
Note: the configuration refers to the unknown class 'javax.swing.JComponent'
Note: there were 3 references to unknown classes.
You should check your configuration for typos.
The output jar is empty. Did you specify the proper '-keep' options?

=============== 编辑:proguard.cfg =====================

-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService

-keep public class MyClass extends MyView {

public static String GetSessionID () {
}
}

-keepclasseswithmembernames class * {
native <methods>;
}

-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}

最佳答案

将这一行添加到您的混淆文件中。

 -keep class <your jar file name>.** { *; }

关于android - 生成用于代码分发的混淆 JAR,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20343954/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com