用方法签名Proguard的错误 [英] Proguard error with method signatures

查看:427
本文介绍了用方法签名Proguard的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到一个奇怪的错误,而试图让我的Andr​​oid应用程序的Proguard的版本。该错误是:

I'm getting a strange error while trying to make a Proguard version of my Android app. The error is:

[proguard] Optimizing...  [proguard]
Unexpected error while evaluating
instruction:  [proguard]   Class      
= [net/domain/packagename/service/ExifEditor]
[proguard]   Method      =
[setGpsLocation(DDDJ)V]  [proguard]  
Instruction = [294] aload_3 v3 
[proguard]   Exception   =
[java.lang.IllegalArgumentException]
(Value is not a reference value
[proguard.evaluation.value.UnknownDoubleValue])
[proguard] Unexpected error while
performing partial evaluation: 
[proguard]   Class       =
[net/domain/packagename/service/ExifEditor]
[proguard]   Method      =
[setGpsLocation(DDDJ)V]  [proguard]  
Exception   =
[java.lang.IllegalArgumentException]
(Value is not a reference value
[proguard.evaluation.value.UnknownDoubleValue])

BUILD FAILED
D:\sdk\google\android-sdk-windows\tools\ant\main_rules.xml:430: java.lang.IllegalArgumentException:
Value is not a reference value
[proguard.evaluation.value.UnknownDoubleValue]
        at proguard.evaluation.value.Value.referenceValue(Value.java:97)
        at proguard.evaluation.Variables.aload(Variables.java:264)
        at proguard.evaluation.Processor.visitVariableInstruction(Processor.java:677)
        at proguard.classfile.instruction.VariableInstruction.accept(VariableInstruction.java:306)
        at proguard.optimize.evaluation.PartialEvaluator.evaluateSingleInstructionBlock(PartialEvaluator.java:729)
        at proguard.optimize.evaluation.PartialEvaluator.evaluateInstructionBlock(PartialEvaluator.java:560)
        at proguard.optimize.evaluation.PartialEvaluator.evaluateInstructionBlockAndExceptionHandlers(PartialEvaluator.java:533)
...and so on...

方法setGpsLocation有这样的签名:

The method "setGpsLocation" has this signature:

public void setGpsLocation(double longitude, double latitude, double altitude, long gpsTime) throws IOException

我最终摆脱错误的,通过改变方法如下:

I ended up getting rid of the error, by changing the method to this:

public void setGpsLocation(Location location)

和错误消失。虽然这让我过去吧,我不明白什么是错与第一种方法的签名。我proguard.cfg有-optimizationpasses 2.如果我增加该值以3个或更多,我开始看到类似的错误,用code的其他地区。这里是如果我使用3会发生什么:

and the error goes away. While this gets me past it, I don't understand what was wrong with the first method signature. My proguard.cfg has -optimizationpasses 2. If I increase this value to 3 or more, I start seeing similar errors with other areas of code. Here's what happens if I use 3:

[proguard] Optimizing...   [proguard]
Unexpected error while evaluating
instruction:   [proguard]   Class     
= [org/apache/commons/fileupload/util/Streams]
[proguard]   Method      =
[copy(Ljava/io/InputStream;Ljava/io/OutputStream;Z[B)J]
[proguard]   Instruction = [75]
aload_2 v2   [proguard]   Exception  
= [java.lang.IllegalArgumentException] (Value is not a reference value
[proguard.evaluation.value.UnknownIntegerValue])
[proguard] Unexpected error while
performing partial evaluation: 
[proguard]   Class       =
[org/apache/commons/fileupload/util/Streams]
[proguard]   Method      =
[copy(Ljava/io/InputStream;Ljava/io/OutputStream;Z[B)J]
[proguard]   Exception   =
[java.lang.IllegalArgumentException]
(Value is not a reference value
[proguard.evaluation.value.UnknownIntegerValue])

我有一个很难找到什么这个错误可能意味着信息。

I'm having a hard time finding information about what this error can mean.

有其他人看到类似的东西?

Has anyone else seen something similar?

更新

虽然更改签名似乎解决这​​个问题,我得到一个运行时崩溃:

While changing the signature appeared to solve the issue, I was getting a runtime crash:

I/dalvikvm(30523): Could not find method a.b.a.b.d.b, referenced from method a.b.a.b.d.a
W/dalvikvm(30523): VFY: unable to resolve direct method 440: La/b/a/b/d;.b (Ljava/lang/String;[BII)La/b/a/b/a;
D/dalvikvm(30523): VFY: replacing opcode 0x70 at 0x0039
D/dalvikvm(30523): VFY: dead code 0x003c-0041 in La/b/a/b/d;.a (Ljava/lang/String;[BII)[La/b/a/b/a;
W/dalvikvm(30523): VFY: 'this' arg 'Ljava/lang/Object;' not instance of 'Ljava/io/InputStream;'
W/dalvikvm(30523): VFY:  rejecting opcode 0x6e at 0x0045
W/dalvikvm(30523): VFY:  rejected La/b/a/a/a/b;.a (La/b/a/b/a/a;La/b/a/a;)La/b/a/a/a/c;
W/dalvikvm(30523): Verifier rejected class La/b/a/a/a/b;
W/dalvikvm(30523): threadid=10: thread exiting with uncaught exception (group=0x400259f8)

我开始读更多的Proguard的手册,并通过添加-dontoptimize发现,编译时错误和运行时的崩溃消失。排序失败使用ProGuard的目的,不是吗?

I started reading more of the Proguard manual, and found by adding -dontoptimize, the build-time errors and runtime crashes go away. Sort of defeats the purpose of using Proguard, doesn't it?

-Kevin

推荐答案

该错误表明,有在的ProGuard的优化步骤的错误。你应该确保您使用的是最新版本(4.5.1 ProGuard的还是在这个时候写的4.6 beta3版)。如果问题仍然存在,您应该ProGuard的bug跟踪系统提交错误报告,用一个小样本项目,允许重现该问题。

The error suggests that there is a bug in ProGuard's optimization step. You should make sure you are using the latest version (ProGuard 4.5.1 or 4.6 beta3 at this time of writing). If the problem persists, you should file a bug report in the ProGuard bug tracker, with a small sample project that allows to reproduce the problem.

这篇关于用方法签名Proguard的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆