BlackBerry 出现 Module xxx' has verification error 有关问题解决方法
如果是MIDLET请看官方的解释:
http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800708/800647/Support_-_MIDlet_has_verification_error_at_offset.html?nodeid=800711&vernum=0
我使用的不是MIDLET同样出现了问题,
http://supportforums.blackberry.com/t5/Java-Development/verification-error-1756/td-p/125387
那么引起verification error的原因是使用了XXX.class代码,
比如:
EventManager.registerListener(new EventTypeFilter(this, new Class[]{ myEventObject.class }));
上面的代码就不行,虽然RIM API说支持,但依然出现了问题,改写成下面的:
EventManager.registerListener(new EventTypeFilter(this, new Class[]{ new myEventObject().getClass() }));
就可以了。
另外还有其他的的原因,我从****转来的,保存一下吧。
http://blog.****.net/wang_shaner/archive/2011/01/17/6145963.aspx
When developing Java applications for the BlackBerry smartphone, you may encounter any of the following verification errors or errors similar to the following: These errors often occur when creating MIDlets. They are inherently hard to debug because the same error message can apply to a number of problems. The following is a list of possible solutions to prevent or correct verification errors: Class1 class1= new Class1(Class2.class.getName()); To work around this issue, do not make the class call within a constructor as shown in the following example: Class1 class1; public class MyOuterClass { There are a few ways you can remove these references, such as creating javac.exe -source 1.3 -target 1.1
一般情况下将引用的jar包从build path里面remove,然后再重新add就可以了。System.out.*
calls. These generally do nothing on the BlackBerry smartphone, but they might cause verification errors.import
statements.public
, private
, or protected
.public
.javax.microedition.rms.RecordStore
class is compiled using BlackBerry® Java® Development Environment (BlackBerry JDE) earlier than version 4.0. This occurs if the application uses either the addRecordListener
or removeRecordListener
methods of the RecordStore
class. To resolve this issue, recompile the application using BlackBerry JDE 4.0 or later.
String className = Class2.class.getName();
Class1 = new Class1(className);
static int var;
class MyInnerClass {
public void doSomething() {
var = 7;
}
}
}get/set
methods for var
in the outer class or modifying the logic to pull MyInnerClass
out of MyOuterClass
.javac
command, and then runs preverify.exe file and then RAPC. Add the following command line arguments to javac
to help avoid issues in earlier versions of the RAPC: