android.txt文件中的proguard解析异常

时间:2014-01-20 14:09:58

标签: java android proguard

我得到了这个例外。

proguard.ParseException: Expecting opening '(' or separator ';' before '=' in line 48 of file 'D:\adt-bundle-windows-x86_64-20130717\adt-bundle-windows-x86_64-20130717\sdk\tools\proguard\proguard-android.txt', 

和第47-56行在

之下
-keepclassmembers class com.sec.svoice.api.SVoice {
    private java.lang.long interface_handle = -1L;
    private java.lang.long sentinel_handle = -1L;
    private java.lang.String host;
    private java.lang.int port;
    private java.lang.String deviceId;
    public static final java.lang.int SP_ASR = 1;
    public static final java.lang.int SP_NLU = 2;
    static final java.lang.int[] seed;
}

2 个答案:

答案 0 :(得分:2)

假设大多数这些字段实际上是基元,正确的语法是:

-keepclassmembers class com.sec.svoice.api.SVoice {
    private long interface_handle;
    private long sentinel_handle;
    private java.lang.String host;
    private int port;
    private java.lang.String deviceId;
    public static final int SP_ASR;
    public static final int SP_NLU;
    static final int[] seed;
}

如果您愿意,可以省略修饰符:

-keepclassmembers class com.sec.svoice.api.SVoice {
    long interface_handle;
    long sentinel_handle;
    java.lang.String host;
    int port;
    java.lang.String deviceId;
    int SP_ASR;
    int SP_NLU;
    int[] seed;
}

如果这些都是字段,则可以使用通配符:

-keepclassmembers class com.sec.svoice.api.SVoice {
    <fields>;
}

如果要保留字段以进行序列化,则可能只需要非静态字段:

-keepclassmembers class com.sec.svoice.api.SVoice {
    !static <fields>;
}

答案 1 :(得分:0)

从变量

中删除赋值后不需要赋值