0

来自 giphy 的文档中获取趋势 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 的生产密钥,但没有运气。

4

1 回答 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.**
于 2019-02-21T08:16:02.487 回答