3

我有一堂课:

public class ObjectSettings 
{
public TextureRegion Region;
public ObjectType ObjectType;
public ObjectAffect ObjectAffect;
public String Name;
public int MinimumInterval = 0;
public int MaximumInterval = 0;
public Vector2 Center;

public static ObjectSettings load(int number) {
    ObjectSettings settings = null;
    try {
        Json json = new Json();     
        settings = json.fromJson(ObjectSettings.class, Integer.toString(number) + 
        Constants.FILE_EXT_JSON));
    } finally {};
    return settings;
}
}

当我使用 proguard 时,我收到以下错误:

02-19 08:48:56.709: E/AndroidRuntime(29042): com.badlogic.gdx.utils.SerializationException: Error reading file: data/settings/0.json

和:

02-19 08:48:56.709: E/AndroidRuntime(29042): Caused by: com.badlogic.gdx.utils.SerializationException: Field not found: ObjectType (com.myname.mapapp.data.ObjectSettings)

我需要在我的 proguard.cfg 文件中添加什么?

4

1 回答 1

3

我有一个类似的问题,这对我有用:

-keepclassmembers class yourPackageName.YourClassName{
   *;
}

YourClassName并且yourPackageName是您传递给 fromJson 函数的类和类包的名称。

于 2013-04-17T07:58:35.140 回答