We need to store and receive the content that users generate using our application on the Internet. To do this, we decided to use the Android Studio integrated Google Cloud Endpoints template to quickly create an API (an official use case here ).
It works great when debugging, but in release mode, provided Proguard is turned on, it fails. Even worse, I did not find any documentation or samples about using Proguard with Android Studio Endpoints templates.
After an hour or so, to get out and try to get it to work, proguard-rules.pro now looks like this:
-keep class com.google.api.** { public *; } -dontwarn com.google.api.** -keep class com.google.common.** { public *; } -dontwarn com.google.common.** # Not allowed to post company and app names, but this line is correct in the real file -keep class com.companyname.appname.application.backend.** { *; }
In this configuration, I get a class exception in my ArrayAdapter :
java.lang.ClassCastException: com.google.api.client.util.ArrayMap cannot be cast to com.companyname.appname.application.backend.messageApi.model.Message
It seems that the conversion of the returned data is not performed somewhere and instead of the List objects from Message , I get List objects from com.google.api.client.util.ArrayMap (they contain valid data, by the way).
I CAN check whether the application is in release mode and does the conversion manually, however this is a hacker approach and I would prefer to do it correctly. So, can someone please tell me what I am missing in the Proguard configuration file?
source share