1

结果我在我的 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 文件?

4

1 回答 1

2

参照。ProGuard 手册 > 故障排除 > 警告:找不到超类或接口。

Jacorb 似乎依赖于 JGSS,它不是 Android 运行时的一部分。理论上,JGSS 应该被指定为一个库包。但是,由于您的应用程序在没有 JGSS 的情况下已经可以正常运行,因此可以公平地假设这部分代码从未使用过。然后,您可以关闭警告:

-dontwarn org.ietf.jgss.**

ProGuard 将不再抱怨这些丢失的类并继续处理代码。控制台输出中的摘要表明有许多类可能相似。

于 2011-03-25T21:59:44.513 回答