- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
在使用 android 运行 proguard 时,我遇到了一个奇怪的错误。这个错误意味着什么,有什么办法可以解决这个问题,
我使用的是 ProGuard,版本 4.4安卓 2.3.1
2011-05-17 17:55:25 - tests] Optimizing...
[2011-05-17 17:55:25 - tests] Proguard returned with error code 1. See console
[2011-05-17 17:55:25 - tests] Unexpected error while evaluating instruction:
[2011-05-17 17:55:25 - tests] Class = [com/test/service/DownloadBarCodeService]
[2011-05-17 17:55:25 - tests] Method = [onHandleIntent(Landroid/content/Intent;)V]
[2011-05-17 17:55:25 - tests] Instruction = [170] iload v14
[2011-05-17 17:55:25 - tests] Exception = [java.lang.NullPointerException] (null)
[2011-05-17 17:55:25 - tests] Unexpected error while performing partial evaluation:
[2011-05-17 17:55:25 - tests] Class = [com/test/service/DownloadBarCodeService]
[2011-05-17 17:55:25 - tests] Method = [onHandleIntent(Landroid/content/Intent;)V]
[2011-05-17 17:55:25 - tests] Exception = [java.lang.NullPointerException] (null)
[2011-05-17 17:55:25 - tests] java.lang.NullPointerException
[2011-05-17 17:55:25 - tests] at proguard.evaluation.Variables.iload(Variables.java:228)
[2011-05-17 17:55:25 - tests] at proguard.evaluation.Processor.visitVariableInstruction(Processor.java:645)
[2011-05-17 17:55:25 - tests] at proguard.classfile.instruction.VariableInstruction.accept(VariableInstruction.java:306)
[2011-05-17 17:55:25 - tests] at proguard.optimize.evaluation.PartialEvaluator.evaluateSingleInstructionBlock(PartialEvaluator.java:729)
[2011-05-17 17:55:25 - tests] at proguard.optimize.evaluation.PartialEvaluator.evaluateInstructionBlock(PartialEvaluator.java:575)
[2011-05-17 17:55:25 - tests] at proguard.optimize.evaluation.PartialEvaluator.evaluateInstructionBlockAndExceptionHandlers(PartialEvaluator.java:533)
[2011-05-17 17:55:25 - tests] at proguard.optimize.evaluation.PartialEvaluator.visitCodeAttribute0(PartialEvaluator.java:221)
[2011-05-17 17:55:25 - tests] at proguard.optimize.evaluation.PartialEvaluator.visitCodeAttribute(PartialEvaluator.java:180)
[2011-05-17 17:55:25 - tests] at proguard.optimize.evaluation.LivenessAnalyzer.visitCodeAttribute(LivenessAnalyzer.java:195)
[2011-05-17 17:55:25 - tests] at proguard.optimize.evaluation.VariableOptimizer.visitCodeAttribute(VariableOptimizer.java:102)
[2011-05-17 17:55:25 - tests] at proguard.classfile.attribute.CodeAttribute.accept(CodeAttribute.java:101)
[2011-05-17 17:55:25 - tests] at proguard.classfile.ProgramMethod.attributesAccept(ProgramMethod.java:79)
[2011-05-17 17:55:25 - tests] at proguard.classfile.attribute.visitor.AllAttributeVisitor.visitProgramMember(AllAttributeVisitor.java:95)
[2011-05-17 17:55:25 - tests] at proguard.classfile.util.SimplifiedVisitor.visitProgramMethod(SimplifiedVisitor.java:91)
[2011-05-17 17:55:25 - tests] at proguard.classfile.ProgramMethod.accept(ProgramMethod.java:71)
[2011-05-17 17:55:25 - tests] at proguard.classfile.ProgramClass.methodsAccept(ProgramClass.java:439)
[2011-05-17 17:55:25 - tests] at proguard.classfile.visitor.AllMethodVisitor.visitProgramClass(AllMethodVisitor.java:47)
[2011-05-17 17:55:25 - tests] at proguard.classfile.ProgramClass.accept(ProgramClass.java:281)
[2011-05-17 17:55:25 - tests] at proguard.classfile.ClassPool.classesAccept(ClassPool.java:114)
[2011-05-17 17:55:25 - tests] at proguard.optimize.Optimizer.execute(Optimizer.java:764)
[2011-05-17 17:55:25 - tests] at proguard.ProGuard.optimize(ProGuard.java:325)
[2011-05-17 17:55:25 - tests] at proguard.ProGuard.execute(ProGuard.java:114)
[2011-05-17 17:55:25 - tests] at proguard.ProGuard.main(ProGuard.java:499)
最佳答案
我遇到了同样的问题。这是原始代码:
boolean mExternalStorageAvailable = false;
boolean mExternalStorageWriteable = false;
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state)) {
// We can read and write the media
mExternalStorageAvailable = true;
mExternalStorageWriteable = true;
} else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
// We can only read the media
mExternalStorageAvailable = true;
mExternalStorageWriteable = false;
} else {
// Something else is wrong. It may be one of many other states, but
// all we need to know is we can neither read nor write
mExternalStorageAvailable = false;
mExternalStorageWriteable = false;
}
return (mExternalStorageAvailable && mExternalStorageWriteable);
Proguard 最后一行有问题!我最终得到了 2 个解决方案。
解决方案#1:不在开头初始化 2 个 bool 变量:
boolean mExternalStorageAvailable;
boolean mExternalStorageWriteable;
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state)) {
// We can read and write the media
mExternalStorageAvailable = true;
mExternalStorageWriteable = true;
} else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
// We can only read the media
mExternalStorageAvailable = true;
mExternalStorageWriteable = false;
} else {
// Something else is wrong. It may be one of many other states, but
// all we need to know is we can neither read nor write
mExternalStorageAvailable = false;
mExternalStorageWriteable = false;
}
return (mExternalStorageAvailable && mExternalStorageWriteable);
解决方案 #2 是返回 true/false 而不是设置 2 个 bool 值。
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state)) {
// We can read and write the media
return true;
} else {
return false;
}
对于这种情况,它工作正常(并且可能更好),但我很高兴我没有在更复杂的函数中遇到这个问题!
关于android - 使用 android "Unexpected error while evaluating instruction"运行混淆器时出现奇怪错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6030972/
我被卡住了,请重新审视这个问题。 我正在与其他人的意大利面条式代码一起工作,这些代码不再存在,并且有很多时间弄清楚他们正在评估什么。 在查询转储中,我看到
真实世界Haskell的第8章 globToRegex' (c:cs) = escape c ++ globToRegex' cs 这个函数不是尾递归的,它说答案依赖于 Haskell 非严格(惰性)
来自 Haskell,我正在阅读 Idris 关于懒惰(非严格)的故事。我翻了翻最近的发行说明,还有 found code类似于以下 myIf : (b : Bool) -> (t : Lazy a)
我正在读这个帖子 A custom find function并指出了这一点 有趣的结果。请注意,Evaluate 与 Application.Evaluate 相同,并且所需时间大约是 Active
R包裹mice带有以下示例: library("mice") imp <- mice(nhanes) fit <- with(data=imp,exp=lm(bmi~hyp+chl)) 我想要一个灵活
我正在尝试使用 PHPUnit 3.6.4 对我的 Zend Framework 应用程序进行单元测试。当我在命令提示符中尝试此命令时,出现以下错误。 C:\xampp\htdocs\testsamp
我希望函数的结果是: 所有值的计算结果均为 False(无、0、空字符串)-> True 所有值的计算结果为 True -> True 所有其他情况 -> 错误 这是我的尝试: >>> def con
我可以使用 puppeteer 导航到一个页面但后来page.evaluate没有返回任何响应。此外,我无法在 page.evaluate 内部进行调试。任何一个。我在 Debug模式下运行脚本( n
from surprise import Reader, Dataset, SVD from surprise import evaluate ----------------------------
使用 PhantomJS 考虑以下代码片段: var reloadAfterLogin = false; function(user, pass, debug){ // step 3 submit L
我知道流是惰性的,直到在流上调用终端方法。我所知道的是,在调用终端方法之后,所有中间方法都按调用顺序执行。 但是对于下面的程序,我无法理解流是如何工作的。这是代码,我试过了。 import java.
最近我开始研究 VS2012。 当我调试代码(这是 SharePoint 2013 应用程序)并尝试获取变量的值时 - 我一次又一次收到消息: Function evaluation disabled
我正在阅读 David Flanagan 的《JavaScript:权威指南》,这可能是世界上最厚的 JavaScript 书。在简要描述数组初始值设定项时,弗拉纳根说“每次数组初始值设定项时都会评估
在 puppeteer 截取屏幕截图之前,我试图让代码执行等待所有图像加载完毕。当调用 initData() 函数时,我的 DOM 被填充,该函数在客户端 js 文件中定义。延迟或超时是一种选择,但我
对国际通用标准有一些批评,如 [Under-attack]。 1 您认为使用 CC 开发 IT 产品的利弊是什么? 最佳答案 我是 BSI(德国)和 NIAPP(美国)计划的通用标准评估员。我有一些经
关闭。这个问题是off-topic .它目前不接受答案。 想改善这个问题吗? Update the question所以它是 on-topic对于堆栈溢出。 11 年前关闭。 Improve this
在非严格求值语言中,使用按名称调用与通过宏扩展调用有何区别和优点/缺点? 您能否提供一个示例来解释这两种评估策略? 谢谢! 最佳答案 按姓名调用: 按名称调用是一种求值策略,其中函数的参数在调用函数之
我真的无法在 Modelica 规范中找到任何答案,所以我想问问你们。规范指出如果表达式的值不影响结果(例如, bool 表达式的短路评估),工具可以自由地求解方程、重新排序表达式和不计算表达式。 I
我想尝试惰性表达式评估,但我现在不想深入研究 Haskel。拜托,你能帮忙找出其他语言有这个功能吗? 最佳答案 你可以用多种语言模拟它。 this例如,是 C++ 的通用惰性求值器。正如文章所说,它也
关注,据说foldl'是 foldl 的严格版本. 但是我很难理解,strict 是什么意思?意思是?? foldl f z0 xs0 = lgo z0 xs0 where
我是一名优秀的程序员,十分优秀!