I integrated baidu maps as per the sample code available from the baidu maps sdk example center.

Everything works fine, but in the release build baidu map crashes everytime.

The error was something like this.

NoSuchMethodError: no static method "Lvi/com/gdi/bgl/android/java/EnvDrawText;

I was wondering what the reason could be.

1

There are 1 answers

0
Monster Brain On BEST ANSWER

The issue was with a missing proguard config. When is set minifyEnabled to false it works fine. So added this extra line -keep class vi.com.gdi.bgl.android.** {*; } to the baidu maps proguard rules. Final set of rules become ...

# Baidu Map rules
-keep class com.baidu.** {*;}
-keep class mapsdkvi.com.** {*;}
-keep class vi.com.gdi.bgl.android.** {*; }
-dontwarn com.baidu.**

And the crash is gone.