Giphy android sdk没有返回发布版本的数据

问题描述 投票:0回答:1

来自giphy的docs的示例代码用于获取趋势gif

/// 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");
            }
        }
    }
});

此代码在开发环境中正常工作。但在发布版本中,result.getData()总是返回null。无法弄清楚问题是什么。我也尝试过giphy的生产密钥,但没有运气。

android giphy
1个回答
1
投票

需要为giphy添加proguard规则

-keepclassmembernames class com.giphy.sdk.core.models.** { *; }
-keepclassmembernames class com.giphy.sdk.core.network.response.** { *; }
-keepattributes *Annotation*
-dontwarn com.giphy.sdk.core.**
© www.soinside.com 2019 - 2024. All rights reserved.