APP版本上的Proguard错误 - android / arch / core / internal / SafeIterableMap

时间:2017-12-27 18:53:09

标签: java android android-studio proguard android-proguard

优化应用后,Proguard失败了此消息。

compileSdkVersion = 27

buildToolsVersion =" 27.0.3"

minSdkVersion = 16

targetSdkVersion = 27

Shrinking... Removing unused program classes and class elements... Original number of program classes: 6833 Final number of program classes: 6348 Optimizing... Unexpected error while computing stack sizes: Class = [android/arch/core/internal/SafeIterableMap$1] Method = [zzf(Ljava/lang/String;)J] Exception = [java.lang.IllegalArgumentException] (Stack size becomes negative after instruction [24] invokestatic #4625 in [android/arch/core/internal/SafeIterableMap$1.zzf(Ljava/lang/String;)J]) Warning: Exception while processing task java.io.IOException: java.lang.IllegalArgumentException: Stack size becomes negative after instruction [24] invokestatic #4625 in [android/arch/core/internal/SafeIterableMap$1.zzf(Ljava/lang/String;)J] Thread(Tasks limiter_5): destruction :app:transformClassesAndResourcesWithProguardForRelease FAILED

1 个答案:

答案 0 :(得分:4)

在我的情况下,我通过在proguard文件中注释这些行来解决这个问题:

#-assumenosideeffects class android.util.Log {
#    public static *** d(...);
#    public static *** v(...);
#    public static *** i(...);
#    public static *** w(...);
#    public static *** e(...);

我最终使用if(BuildConfig.DEBUG)为每个日志