LibGDX proguard

2019-07-26 03:00发布

I have been trying to shrink the size of my libGDX game .jar. I have been trying to get proguard to work. Proguard keeps complaining about missing classes, or the output .jar won't run.

I have tried all the existing configuration files I found for libGDX.

Does anyone have experience with setting up proguard?

1条回答
够拽才男人
2楼-- · 2019-07-26 03:52

You can use the following configuration for libGDX:

-dontwarn com.badlogic.gdx.**
-dontnote com.badlogic.gdx.**

-keepclassmembers class com.badlogic.gdx.graphics.Cubemap* { *; }
-keepclassmembers class com.badlogic.gdx.graphics.GL* { *; }

# for Android backend
-keepclassmembers class com.badlogic.gdx.backends.android.AndroidInput* {
    <init>(com.badlogic.gdx.Application, android.content.Context, java.lang.Object, com.badlogic.gdx.backends.android.AndroidApplicationConfiguration);
}

# for box2d plugin
-keepclassmembers class com.badlogic.gdx.physics.box2d.World {
    boolean contactFilter(long, long);
    void    beginContact(long);
    void    endContact(long);
    void    preSolve(long, long);
    void    postSolve(long, long);
    boolean reportFixture(long);
    float   reportRayFixture(long, float, float, float, float, float);
}
查看更多
登录 后发表回答