当集成Giphy SDK作为模块

时间:2017-11-23 10:33:27

标签: android android-proguard

我试图将Giphy SDK集成到当前项目中。我已按照https://github.com/Giphy/giphy-android-sdk-core的说明操作,它就像一个魅力。 但它无法生成带有以下消息的签名apk:

Warning:Exception while processing task java.io.IOException: Can't write [/Users/xxxxx/Documents/myApp/app/build/intermediates/transforms/proguard/facebook/release/jars/3/1f/main.jar] (Can't read [/Users/xxxxx/Documents/myApp/app/build/intermediates/transforms/FirebasePerformancePlugin/facebook/release/folders/1/4/9295f6fdf93ed7497ff128b73dc55529-classes(;;;;;;**.class)] (Can't read [com] (Can't read [giphy] (Can't read [sdk] (Can't read [core] (Can't read [network] (Can't read [response] (Can't read [ListMediaResponse.class] (Duplicate zip entry [com/giphy/sdk/core/network/response/ListMediaResponse.class])))))))))

我已经添加了亲保护规则,但没有成功。

-keep public class com.giphy.sdk.core.** { *; }
-dontwarn com.giphy.sdk.core.**

有什么方法可以解决吗?感谢。

2 个答案:

答案 0 :(得分:0)

在正确的地方忽略它!这里:build.gradle

android {     // defaultConfig,buildTypes等。

public class SelectedCalcDataConverter : IMultiValueConverter
{
    public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
    {
        var items = values[0] as IEnumerable<CalcData>;
        var selectedId = values[1] as int?;

        if (items != null)
        {
            var result = items.FirstOrDefault(x => x.Condition.Id == selectedId);
            return result;
        }
        return null;
    }

    public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}

}

答案 1 :(得分:0)

发现自己放错了包裹,

compile('com.giphy.sdk:core:1.0.0@aar') {
    transitive=true
}

这应该在将其作为模块导入后添加,并且需要将其放在“模块”中的build.gradle文件中,而不是项目中的那个。虽然在github页面上已经提到过这个,但我已经读过了,但是没想到它只是因为这个而出错了。此外,他们为什么不这么说呢?洛尔。