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的生产密钥,但是没有运气。
答案 0 :(得分:0)
需要为giphy添加保护规则
-keepclassmembernames class com.giphy.sdk.core.models.** { *; }
-keepclassmembernames class com.giphy.sdk.core.network.response.** { *; }
-keepattributes *Annotation*
-dontwarn com.giphy.sdk.core.**