"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,438 Views)


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" 



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:


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.


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