Search code examples
androidgiphy

Giphy android sdk returns no data on release build


The sample code from giphy's docs for getting trending gif is

/// Trending Gifs
client.trending(MediaType.gif, null, null, null, new 
CompletionHandler<ListMediaResponse>() {
    @Override
    public void onComplete(ListMediaResponse result, Throwable e) {
        if (result == null) {
            // Do what you want to do with the error
        } else {
            if (result.getData() != null) {  //Problem on release build
                for (Media gif : result.getData()) {
                    Log.v("giphy", gif.getId());
                }
            } else {
                Log.e("giphy error", "No results found");
            }
        }
    }
});

This code works fine on development environment. But in release build result.getData() always returns null. Unable to figure it out whats the issue. I have tried with giphy's production key also but no luck.


Solution

  • Need to add proguard rules for giphy

    -keepclassmembernames class com.giphy.sdk.core.models.** { *; }
    -keepclassmembernames class com.giphy.sdk.core.network.response.** { *; }
    -keepattributes *Annotation*
    -dontwarn com.giphy.sdk.core.**