Giphy android sdk returns no data on release build

会有一股神秘感。 提交于 2019-12-25 04:06:24

问题


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.


回答1:


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.**


来源:https://stackoverflow.com/questions/54802222/giphy-android-sdk-returns-no-data-on-release-build

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!