Android Proguard failing with “Value 'i' is not a reference value”

假装没事ソ 提交于 2019-12-13 00:15:54

问题


I recently added a library to my app ('GNSDK' by Gracenote) and am now trying to build the app for release using Proguard. I successfully built and installed the release version of the app once, but all subsequent attempts produce this error:

Unexpected error while evaluating instruction:
 Class       = [com/gracenote/gnsdk/GnManager]   
 Method      = [<init>(Landroid/content/Context;Ljava/lang/String;I)V]
 Instruction = [87] getfield #120
 Exception   = [java.lang.IllegalArgumentException] (Value "i" is not a 
  reference value [proguard.evaluation.value.UnknownIntegerValue])
  Unexpected error while performing partial evaluation:
    Class       = [com/gracenote/gnsdk/GnManager]
    Method      = [<init>(Landroid/content/Context;Ljava/lang/String;I)V]
    Exception   = [java.lang.IllegalArgumentException] (Value "i" is not a reference value [proguard.evaluation.value.UnknownIntegerValue])
  :app:proguardBetaRelease FAILED
  Error:Execution failed for task ':app:proguardBetaRelease'.

Value "i" is not a reference value [proguard.evaluation.value.UnknownIntegerValue]`

I tried to force proguard to leave the library alone (since that's the only difference between the debug and release builds) with:

-keep class com.gracenote.** {
    *;
}

but it does not seem to make a difference.

Any hints on how to debug or track down this error? I am not sure why the constructor of com.gracenote.gnsdk.GnManager would be failing. The error makes it sound like it is getting an invalid input.

I'm using Android Studio 1.4, build tools 23.0.0.


回答1:


I found that this is a bug in Proguard: https://sourceforge.net/p/proguard/bugs/573/

Looks like it will be released soon. In the meantime, you can work around by adding:

-optimizations !class/unboxing/enum

to your proguard file.




回答2:


For what it's worth, I found this for a java project. I was running proguard targeting 1.8 when it should have been 1.9. Once I changed it it worked.



来源:https://stackoverflow.com/questions/32185060/android-proguard-failing-with-value-i-is-not-a-reference-value

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!