How to set up pro-guard rules for Cloud Endpoints v2 in Android project

83 Views Asked by At

What should my proguard-rules.pro file look like so that minifyEnabled true works with Cloud Endpoints v2?

When I release my app to Google Play and I have minifyEnabled true in my gradle, I get class not found or nulls for the Cloud Endpoints library classes.

Is there any guide or information on how to configure proguard-rules.pro in Android so proguard works with the Cloud Endpoints V2 libraries?

Or is there some other way to make it work?

1

There are 1 best solutions below

0
Priyansh Kedia On

If you are using minifyEnabled = true along with ProGuard, you should add this in your proguard-rules.pro file

-keep public class com.google.cloud.** {  
    public *;  
}

if your dependencies for cloud endpoints start with com.google.cloud or

-keep public class com.google.endpoints.** {  
    public *;  
}

if your dependencies for cloud endpoints start with com.google.endpoints or add both (depending on the dependencies you add).