"Error starting MyApp: Module 'MyApp' has verification error 2778 at offset 3fce"
It appears that the two numbers (2778 and 3fce, in this case) are not helpful in diagnosing the problem. Basically, you're on your own. And it's going to get ugly.
According to RIM, it's likely that the COD files have been corrupted. Unfortunately, this can happen just by building with the rapc compiler, and optionally signing the app. So, what can you do? Well, I've fought with this a few times and I can at least give you some suggestions to try:
1) If you started by building a JAR and then used the rapc compiler to create COD files, make sure you turn obfuscation off when building the JAR. The rapc compiler will do its own obfuscating and it often has issues if the code is already obfuscated.
2) Comment out dead code. Sometimes the verification errors seem to have something to do with the size of the main code file and the library files. If you comment out some code that never gets called, the file sizes change somewhat, and this often fixes the problem.
3) Remove references to a static instance variable from an inner class. For example, code like the following can sometimes be a problem:
public class MyOuterClass {
static int var;
class MyInnerClass {
public void doSomething() {
var = 7;
}
}
}
There are a few ways you can try to remove these references. E.g., create get/set methods for var in the outer class, or modify your logic so you can pull MyInnerClass out of MyOuterClass.
4) Remove any System.out.* calls. These generally do nothing on the Blackberry, but sometimes cause verification errors.
5) Remove unused import statements.
6) Explicitly specify the access for every function or variable (i.e., make sure every one is specified as public, private, or protected). It's pretty easy to grep your Java code to find the missing access specifications.
Now, it's not clear to me whether these changes actually fix anything. However, you're really just stabbing in the dark with verification errors, so any changes you can think to make may help. My best advice is to use source control and build/test often. You're really just trying to avoid code that makes the compiler unhappy. And it's much easier to do this if 15 lines of code have been checked in since it last worked, as opposed to 1000.