开发者

Blackberry runtime error: FRIDG: could not find img/logo.png

开发者 https://www.devze.com 2023-03-27 00:35 出处:网络
I recently had to prepare a BB app for submission to the BB app world, but I have an issue when running the app. Basically, I\'ve created a new Blackberry project, using the \"use existing source\" op

I recently had to prepare a BB app for submission to the BB app world, but I have an issue when running the app. Basically, I've created a new Blackberry project, using the "use existing source" option to point to the sources I've got from the developer that actually developed this app. Building the application just works, but when I want to start the app it immediately quit开发者_如何学Pythons with a NullPointerException.

When debugging the application, the debugger halts at the following line:

Bitmap bitmaplogo = EncodedImage.getEncodedImageResource("img/logo.png").getBitmap();

With the following error:

[0.0] FRIDG: could not find img/logo.png

I do have an img/logo.png, which is located in /res/img/logo.png. Attempts of specifying the path as "res/img/logo.png", "/res/img/logo.png", "logo.png" have not worked. I personally don't think that's the issue here, this exact code base works perfectly for another developer. I'm more inclined to start looking into tooling, JDK/JRE versions, project settings. Maybe resource files should be explicitly included in the build?

Some other information:

  • My Blackberry project uses Blackberry JRE 5.0.0 as the JRE system library
  • I have Oracle Java SDK 6 Update 26 installed
  • Using Blackberry Java Plugin for Eclipse 1.3.0
  • On Windows XP SP2

Has anyone encountered the same issue before?


  1. Filenames and extensions are case sensitive. logo.png and logo.PNG are different files from application's point of view. So, be careful with naming files and folders.

  2. The root folder for images you get in your application is the root folder of your source files package.

For instance, if you have the following folder structure:

YourProject
   src\
      com\
        company\
             etc\
   img\

Then the root folder for your images will be: YourProject\src

Image files located in YourProject\img folder are invisible for your application code, unless img folder is located in YourProject\src and the full path is:

YourProject\src\img

and your image file has the full path like that:

YourProject\src\img\logo.png

In this case you can load the image via specifying it's path: img\logo.png

and without it, just via specifying: logo.png

Specifying the full path is recommended if you have several images with similar filenames.

If you have several files logo.png in your project, and you load it via specifying only file name "logo.png" then the first found image from your project will be loaded.

Resume: transfer your img folder into the src folder.


Not sure if this is the same as your problem, but when I get those types of errors, it usually means that I need to force the project in Eclipse to refresh (right-click on project and choose Refresh) and then rebuild.

0

精彩评论

暂无评论...
验证码 换一张
取 消