Build Android with minifyEnabled true - Cocos2d-x

Hello,

It’s my first experience with Cocos2d-x Game Engine, I develop an android game using Cocos2d-x (Latest version). I think I should to reduce the size of my game using proguard but I have 2 questions before to do that:

1- Is it possible to build Android platform with minifyEnabled true, what classes I have to keep in proguard-rules file ?

2- If I set minifyEnabled to true, will my game be slow ?

Thank you,

Any update on this topic, I did raise same question before but no replies

In fact there is any update on this topic, but I already tried to set minifyEnabled to true and I encountered a lot of problems… so I left it to false.

Try updating your proguard-rules.pro to something like this

# cocos2d-x
-keep public class org.cocos2dx.** { *; }
-dontwarn org.cocos2dx.**
-keep public class com.chukong.** { *; }
-dontwarn com.chukong.**

# google play service
-keep public class com.google.android.gms.** { public *; }
-dontwarn com.google.android.gms.**

# facebook
-keep public class com.facebook.** { *; }
-dontwarn com.facebook.**

# Apache HTTP
-keep class org.apache.http.** { *; }
-dontwarn org.apache.http.**

# Android WebKit
-keep public class android.net.http.SslError
-keep public class android.webkit.WebViewClient

-dontwarn android.webkit.WebView
-dontwarn android.net.http.SslError
-dontwarn android.webkit.WebViewClient

# Android Support
-keep class * extends java.util.ListResourceBundle {
    protected Object[][] getContents();
}

-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
    public static final *** NULL;
}

-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
    @com.google.android.gms.common.annotation.KeepName *;
}

-keepnames class * implements android.os.Parcelable {
    public static final ** CREATOR;
}

# SDKBOX
-keep public class com.sdkbox.** { *; }
-dontwarn com.sdkbox.**
1 Like