Class not found exception after adding a new image to the resource folder

≯℡__Kan透↙ 提交于 2019-12-24 03:26:38

问题


The app works perfectly fine on the simulator and on the device. After adding a new set of images, it started to show on every run, on the simulator and on the device, a class not found exception.

When trying to delete some images to find the cause, I get different classes not found when running. Compiling and packaging the application generates no warning or error. They even get signed. Some of the "classes not found exception" I get:

java.lang.stringbuilder net.rim.device.api.ui.uiapplication

I am guessing it has something to do with the total image size. The size of each image ranges from 100KB to 300KB, and we are talking of only 25 to 30 images in total. Adding the image outside of the 'res' folder doesn't generate the error, but the image isn't added to the final files. Deleting the images, the ones just added resolved the issue, but I need those images...

Also, this application is not big, but when compiling, and packaging the app, it generates and signes 125 cod files. Is that normal?

I am using Eclipse 3.6(Helios), and BlackBerry Eclipse Plugin SDK 5.0.0.25 on Win 7

Any help will be appreciated. Thanks.


回答1:


Each .cod file is limited to about 64K. If your 25-30 images average about 200K, the 125 cod files doesn't surprise me.

The error messages sound like rapc is getting very confused. After you add your images, try refreshing the project or even exiting and restarting Eclipse, then clean and build the project from scratch.

Including large amounts of media is generally not a good app design for the BB. There's a good discussion here about alternative ways to handle this.




回答2:


It turns out this issue was caused because of the total size of my images, which in turn created more then 127 .cod files. Total number of siblings .cod files is 127, my app had that limit, and this is why some essential classes were not included. I still think the blackberry plugin should warn about this, because it showed no error when compiling, packaging and signing the application. Here is the link from the BlackBerry developer support forums where I got this information:

http://supportforums.blackberry.com/t5/Testing-and-Deployment/The-maximum-size-of-a-BlackBerry-smartphone-application/ta-p/502534

Since I am used to the iOS world, where I can add whatever I want to the app, and it has virtually no limit on the resources I can add, except to consider that the user would have to wait a good amount of time downloading the app, and the 2GB application size, which, really is a lot for 99% of the apps.

So for this app what I did was I added only the essential images as compiled resources in the app, and the rest of the images are downloaded automatically when the application launches the first time.



来源:https://stackoverflow.com/questions/6006493/class-not-found-exception-after-adding-a-new-image-to-the-resource-folder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!