问题
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:
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);
}
来源:https://stackoverflow.com/questions/39249056/libgdx-proguard