Unity SDK: Android build crash with Minify option enabled



  • Hi!
    In Unity, if I compile my game with the Minify option enabled, BrainCloud produces the following error:

    : AndroidJavaException: java.lang.ClassNotFoundException: com.braincloud.unity.RegionLocaleNative
    : java.lang.ClassNotFoundException: com.braincloud.unity.RegionLocaleNative
    :      at java.lang.Class.classForName(Native Method)
    :      at java.lang.Class.forName(Class.java:454)
    :      at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
    :      at com.unity3d.player.UnityPlayer.access$300(Unknown Source:0)
    :      at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:83)
    :      at android.os.Handler.dispatchMessage(Handler.java:102)
    :      at android.os.Looper.loop(Looper.java:246)
    :      at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
    : Caused by: java.lang.ClassNotFoundException: com.braincloud.unity.RegionLocaleNative
    :      ... 8 more
    :   at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <00000000000000000000000000000000>:0
    :   at UnityEngine.AndroidJNISafe.FindClass (System.String name) [0x00000] in <00000000000000000000000000000000>:0
    :   at UnityEngine.AndroidJavaObject._AndroidJavaObject (System.String className, System.Ob
    

    Unity version: 2020.3.30f1
    BrainCloud Client 4.10.1

    Any suggestions? Thanks and please let me know.



  • Hi,
    I temporarily solved it by adding this line in the proguard_user:

    -keep class com.braincloud.unity.* { *; }
    

    so the BrainCloud classes are no longer minified.