Module 'XXXXX' has verification error

转载 2011年01月17日 09:47:00

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就可以了。

 

相关文章推荐

ERROR 1005 (HY000): Can't create table 'XXXXX' (errno: 150)

mysql errno: 150 错误 外键 最近学习QT MySQL,在创建外键参照约束时遇到以下关于错误代码为105的错误消息: ERROR 1005 (HY000): Can't cre...
  • hzx5212
  • hzx5212
  • 2013年07月25日 15:45
  • 1128

Sqoop1.99.7 sqoop2-tool verify 失败 Verification has failed, please check Server logs for further deta

最近在装sqoop2 (Sqoop1.99.7),暂时只支持mysql到hdfs或者hdfs到mysql,不支持hive或者hbase。 但是,安装时遇到了一些问题,解压配置后,执行 sqoop2-t...

VERIFICATION BY ERROR MODELING

  • 2013年06月22日 18:30
  • 13.84MB
  • 下载

TensorFlow运行错误,AttributeError: module 'pandas' has no attribute 'computation'

TensorFlow运行错误,AttributeError: module ‘pandas’ has no attribute ‘computation’在我今天刚开始使用TensorFlow做数字识...

module 'html.parser' has no attribute 'HTMLParseError'

错误描述 python==3.5 django==1.7 django创建项目时报错如下:Traceback (most recent call last): File "/root/envs/d...

AttributeError: module 'requests' has no attribute 'packages'

在一个Python项目中,使用Docker部署项目的发布包。 每次发布的时候,基于ubuntu:latest构建镜像,然后使用pip install requests安装requests软件包。 ...

Python中module 'urllib' has no attribute 'openurl'问题

最近在学习Python时遇到各种各样的问题,在网上搜索解决的同时,想着把自己遇到的问题记录下来,一来使自己印象深刻,二来希望能帮助同样出现问题的人 本人是小白一枚,希望大家多多指教! 在学习Pyth...
  • xybzw
  • xybzw
  • 2016年11月01日 14:17
  • 895

The connection to adb is down, and a severe error has occured 错误解决

eclipse开发Android应用,错误:The connection to adb is down, and a severe error has occured

A fatal error has been detected by the Java Runtime Environment:

今天在用Junit做单元测试,发现出现了一下奇葩的问题: 打开它所说的Log文件,具体错误如下: # # A fatal error has been detected by the J...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Module 'XXXXX' has verification error
举报原因:
原因补充:

(最多只允许输入30个字)