使用 CORBA 混淆 Android 应用程序
结果我在我的 Android 应用程序中使用了 jacorb.jar 和 CORBA 接口。当我尝试使用 Proguard 混淆代码时,我收到很多这样的警告:
[proguard] Warning: org.jacorb.orb.standardInterceptors.SASComponentInterceptor: can't find referenced
class org.ietf.jgss.Oid
结果:
[proguard] Warning: there were 1223 unresolved references to classes or interfaces.
[proguard] You may need to specify additional library jars (using '-libraryjars'),
[proguard] or perhaps the '-dontskipnonpubliclibraryclasses' option.
[proguard] Warning: there were 33 unresolved references to program class member
s.
[proguard] Your input classes appear to be inconsistent.
[proguard] You may need to recompile them and try again.
[proguard] Alternatively, you may have to specify the options
[proguard] '-dontskipnonpubliclibraryclasses' and/or
[proguard] '-dontskipnonpubliclibraryclassmembers'.
My proguard.cfg :
-injars bin/classes
-outjars bin/classes-processed.jar
-libraryjars C:/android-sdk-windows/platforms/android-7/android.jar
-libraryjars libs
-dontpreverify
-repackageclasses ''
-allowaccessmodification
-optimizations !code/simplification/arithmetic
-keepattributes *Annotation*
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontnote
-keep class com.android.vending.billing.**
-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.view.View {
public <init>(android.content.Context);
public <init>(android.content.Context, android.util.AttributeSet);
public <init>(android.content.Context, android.util.AttributeSet, int);
public void set*(...);
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclassmembers class * implements android.os.Parcelable {
static android.os.Parcelable$Creator CREATOR;
}
-keepclassmembers class **.R$* {
public static <fields>;
}
如何纠正这些警告并构建工作 apk 文件?
It so fell out that I use jacorb.jar and CORBA interfaces in my android app. And when I try obfuscate code using Proguard I get a lot of warnings like this one:
[proguard] Warning: org.jacorb.orb.standardInterceptors.SASComponentInterceptor: can't find referenced
class org.ietf.jgss.Oid
And as the result:
[proguard] Warning: there were 1223 unresolved references to classes or interfaces.
[proguard] You may need to specify additional library jars (using '-libraryjars'),
[proguard] or perhaps the '-dontskipnonpubliclibraryclasses' option.
[proguard] Warning: there were 33 unresolved references to program class member
s.
[proguard] Your input classes appear to be inconsistent.
[proguard] You may need to recompile them and try again.
[proguard] Alternatively, you may have to specify the options
[proguard] '-dontskipnonpubliclibraryclasses' and/or
[proguard] '-dontskipnonpubliclibraryclassmembers'.
My proguard.cfg :
-injars bin/classes
-outjars bin/classes-processed.jar
-libraryjars C:/android-sdk-windows/platforms/android-7/android.jar
-libraryjars libs
-dontpreverify
-repackageclasses ''
-allowaccessmodification
-optimizations !code/simplification/arithmetic
-keepattributes *Annotation*
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontnote
-keep class com.android.vending.billing.**
-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.view.View {
public <init>(android.content.Context);
public <init>(android.content.Context, android.util.AttributeSet);
public <init>(android.content.Context, android.util.AttributeSet, int);
public void set*(...);
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclassmembers class * implements android.os.Parcelable {
static android.os.Parcelable$Creator CREATOR;
}
-keepclassmembers class **.R$* {
public static <fields>;
}
How to correct these warnings and build working apk file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
比照。 ProGuard 手册 >故障排除>>警告:找不到超类或接口。
Jacorb 似乎依赖于 JGSS,而 JGSS 不是 Android 运行时的一部分。理论上,JGSS应该被指定为一个库包。但是,由于您的应用程序在没有 JGSS 的情况下已经运行良好,因此可以合理地假设这部分代码从未使用过。然后您可以关闭警告:
ProGuard 将不再抱怨这些缺失的类并继续处理代码。控制台输出中的摘要表明有许多可能相似的类。
Cfr. ProGuard manual > Troubleshooting > Warning: can't find superclass or interface.
Jacorb appears to depend on JGSS, which is not part of the Android runtime. In theory, JGSS should be specified as a library package. However, since your app already runs fine without JGSS, it's fair to assume that this part of the code is never used. You can then switch off the warnings:
ProGuard will no longer complain about these missing classes and proceed with processing the code. The summary in your console output suggests that there are many classes that are probably similar.