在我的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'.
我的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文件?
答案 0 :(得分:2)
(CFR)。 ProGuard manual > Troubleshooting > Warning: can't find superclass or interface.
Jacorb似乎依赖于JGSS,而JGSS不是Android运行时的一部分。理论上,JGSS应该被指定为库包。但是,由于您的应用程序在没有JGSS的情况下已经运行良好,因此可以假设这部分代码从未使用过。然后,您可以关闭警告:
-dontwarn org.ietf.jgss.**
ProGuard将不再抱怨这些缺失的类并继续处理代码。控制台输出中的摘要表明有许多类可能类似。