`

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()
}));

 就可以了。

 

另外还有其他的的原因,我从CSDN转来的,保存一下吧。

 

http://blog.csdn.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:

  • Verification Error 3141
  • Module 'MyMIDlet' has verification error (<###>) at offset <###>.
  • Error starting MyMIDlet: Module 'MyMIDlet' has verification error (<####>) at offset <###>."

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:

  1. If you started by building a Java Archive (JAR) file and then used the RIM Application Program Compiler (RAPC) to create .cod files, make sure you turn obfuscation off when building the JAR file. The RAPC compiler performs its own obfuscation and issues may occur if the code is already obfuscated.
  2. Remove any System.out.* calls. These generally do nothing on the BlackBerry smartphone, but they might cause verification errors.
  3. Remove unused import statements.
  4. Explicitly specify the access for each function or variable. For example, make sure each one is specified as public , private , or protected .
  5. If you are working with a MIDlet, make sure the MIDlet class is declared as public .
  6. Verification errors may occur if the COD file is corrupted or if it was not signed correctly. Make sure that you perform a clean rebuild and that you re-sign your application. Reinstall the application on the BlackBerry smartphone.
  7. Comment out any non-executable code. Verification errors might be related to the size of the main code file and the library files. If you comment out non-executable code, the file sizes change, which may correct the problem.
  8. If you have created any classes that inherit from RIM classes, change the name of any custom methods and members that you created in those classes. This makes sure that you have not named any methods or members of the same name in the internal RIM classes.
  9. If your application is using BlackBerry® Device Software 3.8 or later, verification errors occur when an application that implements the 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.
  10. There is a problem with how the BlackBerry® Java® Virtual Machine (BlackBerry JVM) handles the referencing of a class directly within the constructor of another class. The following is an example:
  11. 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;
    String className = Class2.class.getName();
    Class1 = new Class1(className);

  12. Remove references to a static instance variable from an inner class. For example, the following code example could cause an error:
  13. public class MyOuterClass {
        static int var;
        class MyInnerClass {
            public void doSomething() {
                var = 7;
            }
        }
    }

    There are a few ways you can remove these references, such as creating get/set methods for var in the outer class or modifying the logic to pull MyInnerClass out of MyOuterClass .

  14. The build procedure normally compiles from the java source file with the 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:
  15. javac.exe -source 1.3 -target 1.1

  16. Some methods that are very long can cause verification errors. By breaking these methods into helper methods, you can reduce the likelihood of verification errors.
  17. Although not as likely, some very long method definitions (with 10 or more parameters), and some very long constant definitions (long package structure and/or long names) can also cause verification errors.
一般情况下将引用的jar包从build path里面remove,然后再重新add就可以了。

 

 

 

 

分享到:
评论

相关推荐

    Jenkins Host key verification failed问题解决

    Jenkins Host key verification failed问题解决 ...通过以上解决方法,我们可以成功地解决 Jenkins Host key verification failed 问题,从而确保 Jenkins 可以正常地连接到远程服务器,并执行相应的任务。

    Verification Required(解决方案).md

    Verification Required(解决方案).md

    Certificate Verification Failed(解决方案).md

    Certificate Verification Failed(解决方案).md

    Certificate verification failed(解决方案).md

    Certificate verification failed(解决方案).md

    jenkins发版报错Host key verification failed

    jenkins发版报错Host key verification failed. jenkins发版报错Host key verification failed. jenkins发版报错Host key verification failed. jenkins发版报错Host key verification failed. jenkins发版报错Host ...

    Oracle 常见故障解决方法

    解决方法是升级到 9204 版本后问题解决了。 2. 解决 PRKR-1023 问题 解决方法是在两个节点都做 $ ln -sf /etc/srvConfig.loc /oracle/srvm/config/srvConfig.loc。 3. 解决 PRKR-1064 问题 解决方法是在两个节点...

    页面最效果Verification.html

    在给定的标题"页面最效果Verification.html"中,我们可以理解这是一个关于网页更新的项目,重点是验证(Verification)页面的新效果。描述指出,新页面名为"Verification.html",在页面头部增加了一个链接入口,并且...

    papers about formal verification

    总的来说,“Towards the Verification of Pervasive Systems”这篇论文深入探讨了普及系统的形式化验证问题,并提出了一些实用的方法和技术。通过这些方法的应用,研究人员和工程师可以更加高效地解决普及系统设计...

    bios实用错误提示解决方案

    解决方法包括清理内存插槽,更换内存条,或者更新BIOS以解决兼容性问题。 6. 错误提示:“CPU Fan Error” 这意味着CPU风扇运行异常,可能导致过热。检查风扇连接,清理灰尘,或者更换散热膏和风扇以保持良好的...

    Hardware Design Verification Simulation

    Hardware Design Verification Simulation

    writting testbench verification plan

    - UVM(Universal Verification Methodology):UVM是一种基于SystemVerilog的行业标准验证方法学,提供了用于构建可重用、可扩展和可配置的验证环境的组件和类库。 - OVM(Open Verification Methodology):OVM...

    Verification of Sequential and Concurrent Programs

    然而,并发程序的设计和实现异常复杂,容易出现诸如死锁、活锁、竞态条件等难以预测的问题。因此,确保并发程序的正确性和可靠性显得尤为重要。并发程序验证的目标是通过数学或形式化的方法证明程序的行为符合预期的...

    SystemVerilog For Verification 2nd

    ### SystemVerilog for Verification 第二版 #### 一、书籍概览 本书《SystemVerilog for Verification》第二版由Chris Spear编写,旨在为读者提供一套全面的指导,帮助他们掌握SystemVerilog在验证领域的应用。...

    runtime verification资料

    - **综合性的解决方案**:结合运行时监控与预测分析,提供了全面的软件验证方法。 - **灵活性与扩展性**:支持多种逻辑形式主义,便于定制和扩展监测需求。 - **强大的预测分析能力**:不仅可以监测实际发生的情况,...

    Electronic Design Automation-synthesis,verification and test

    《电子设计自动化——综合、验证与测试》是一本深入探讨电子设计自动化领域的经典著作,...通过阅读这本书,读者不仅可以深化理论理解,还能获得解决实际设计问题的技能,为今后的学术研究或职业生涯打下坚实的基础。

    VerificationCode.rar

    实现:6位随机字符串,包括数字、大小写字母,颜色随机;随机干扰线条和小圆点;...判断验证码输入是否正确;区分字母大小写(感兴趣的可以加上不区分的功能)。可以加公众号【几行简码】(ID:few_codes)免费下载。

Global site tag (gtag.js) - Google Analytics