Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development Knowledge Base

"Unable to get asset" error when using absolute paths within QML

by Retired on ‎05-08-2013 02:47 PM - edited on ‎05-08-2013 02:50 PM by Retired (4,393 Views)

Symptoms

If your application was compiled using the BlackBerry® 10 Native SDK version 10.1 or higher, and the QML references resources using absolute paths, such as
/accounts/1000/appdata/com.sample.app.package441de853/data/image.png, the following error messages will be output when the app is run:

  • "Unable to get asset: (/accounts/1000/appdata/com.sample.app.package441de853/data/image.png)." 
  • Image not found:  "/accounts/1000/appdata/com.sample.app.package441de853/data/image.png" 

 

Diagnosis

Beginning in BlackBerry 10 version 10.1, absolute paths must be prefixed with "file://" in order for them to be resolved as expected. Using the example above, the absolute URL would be changed to:
file:///accounts/1000/appdata/com.sample.app.package441de853/data/image.png

 

Apps compiled using the Native SDK version 10.0.10 or lower will continue to function using absolute paths without "file://" prefixed, but as a best practice should be updated to include this as well.

 

Note: Currently, file paths returned by the FilePicker control do not contain the "file://" prefix, so it needs to be added before the returned path can be used in most scenarios.

Solution

Prefix all absolute file paths with "file://". See the following article for a quick example of how this can be done:

https://developer.blackberry.com/cascades/documentation/ui/image_resources/content.html

Contributors
Users Online
Currently online: 21 members 2,127 guests
Please welcome our newest community members: