为什么要签订黑莓应用程序后,重点codeNumber例外? [英] Why KeyCodeNumber exception after signing Blackberry app?

查看:149
本文介绍了为什么要签订黑莓应用程序后,重点codeNumber例外?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经签订了4.6 code-签名工具4.7黑莓应用程序。但是,启动应用程序第二次时,它抛出一个关键codeNumber例外。

We've signed a 4.7 Blackberry application with the 4.6 code-signing tool. But when starting the application a second time it throws a 'KeyCodeNumber exception'.

任何人的一些线索,为什么我们得到这个例外?

Anybody some clues to why we get this exception?

谢谢!

推荐答案

重点codeNumber异常有待办事项验证过程。

KeyCodeNumber exceptions have todo with the verification process.

黑莓<一个href=\"http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/832062/Support_-_$p$pventing_verification_errors.html?nodeid=1499031&vernum=0\"相对=nofollow>发表文章描述如何prevent验证错误:

Blackberry published an article describing how to prevent verification errors:

在开发Java应用程序
  黑莓智能手机,你可以
  遇到以下的
  验证错误或类似的错误
  为以下内容:

When developing Java applications for the BlackBerry smartphone, you may encounter any of the following verification errors or errors similar to the following:

验证错误3141模块
  MyMIDlet'有验证错误
  (小于###>)偏移和LT; ###>。错误
  开始MyMIDlet:模块'MyMIDlet
  有验证错误(小于####>)在
  通常###>这些错误;偏移LT。
  创建MIDlet的时候发生。他们是
  天生难以调试,因为
  同样的错误信息可应用于
  问题的数量。

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.

下面是为prevent或更正验证错误可能的解决方案列表:

The following is a list of possible solutions to prevent or correct verification errors:


  1. 如果您通过构建一个Java启动
    存档(JAR)文件,然后使用
    RIM应用程序编译器
    (RAPC)创建.cod文件,使
    确定打开混淆断时
    构建JAR文件。该RAPC
    编译器执行自己
    模糊处理,如果可能会出现问题
    在code已经被模糊处理。

  2. 删除任何的System.out。*来电。这些
    一般做什么的
    黑莓智能手机,但他们
    可能导致验证错误。

  3. 删除未使用的import语句。

  4. 显式指定访问
    每个功能或变量。对于
    例如,要确保每一个都是
    指定为公共,私人或
    保护。

  5. 如果您正在使用一个MIDlet工作,
    确保MIDlet类是
    声明为public。

  6. 如果在可能出现验证错误
    COD文件已损坏或者如果它是
    未正确签名。确保
    您执行干净重建和
    您重新签署您的应用程序。
    重新安装的应用程序
    BlackBerry智能手机。

  7. 注释掉任何非可执行code。
    验证错误可能与
    到主code文件的大小
    和库文件。如果你
    注释掉非可执行code,则
    文件大小发生变化,这可能会纠正
    的问题。

  8. 如果您创建的任何类
    从RIM类继承,变更
    任何自定义的方法名称和
    您在这些创建成员
    类。这可以确保您
    没有任何名为方法或
    在同名的成员
    内部RIM类。

  9. 如果您的应用程序是使用
    BlackBerry®设备软件3.8或
    后来,出现验证错误
    当一个应用程序,工具

    javax.microedition.rms.RecordStore
    类使用的BlackBerry编译
    Java®的开发环境
    (黑莓JDE)早于
    4.0版。情况发生在当
    应用程序使用无论是
    addRecordListener或
    的removeRecordListener方法
    RecordStore类。要解决此
    的问题,重新编译应用程序
    使用BlackBerry JDE 4.0或更高版本。

  10. 有一个与怎么有问题
     为BlackBerry®Java®虚拟机
     (黑莓JVM)处理
     一类直接引用
     另一个构造函数中
     类。下面是一个例子:
     1级1级=新
     1级(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);

这是一个内部类中删除一个静态实例变量的引用。例如,下面的$ C $℃实施例可能导致一个错误:

Remove references to a static instance variable from an inner class. For example, the following code example could cause an error:

public class MyOuterClass {
    static int var;
    class MyInnerClass {
        public void doSomething() {
            var = 7;
        }
    }
}

有几个方法可以删除这些引用,如在外部类创建get / set方法对VAR或修改拉MyInnerClass出MyOuterClass的逻辑。

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.


  1. 在构建过程正常
    从Java源文件编译
    使用javac命令,然后
    运行preverify.exe文件,然后
    RAPC。添加下面的命令行
    参数的javac,以帮助避免
    在早期版本的问题
    RAPC:

  1. 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:

的javac.exe -source 1.3 -target 1.1

javac.exe -source 1.3 -target 1.1

这是很长可以将某些方法
导致验证错误。通过
违反这些方法分为帮手
方法,可以减少
验证错误的可能性。

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.

虽然不作为可能,一些非常
长方法定义(10或
多个参数),以及一些很长的
常量定义(长包
结构和/或长名称)可以
也导致验证错误。

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.

这篇关于为什么要签订黑莓应用程序后,重点codeNumber例外?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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