Nativescript-angular: unable to load images from local files in nativescript angular

Created on 4 Nov 2018  路  4Comments  路  Source: NativeScript/nativescript-angular

hear is the error log.
JS: Error in reading bitmap - java.io.FileNotFoundException: /data/data/org.nativescript.testingOne/files/app/images/chair.png (No such file or directory)

hear is the repo issue will recreate from the start itself
https://github.com/tahir-jamil/new-translator

hear is my list
`

Most helpful comment

Hi @tahir-jamil,
The issue in the project is related to wrong image path. ~/ will points to the src folder. In this case, you should change the path from [src]="'~/images/' + item.img" to [src]="'~/app/images/' + item.img"

All 4 comments

Hi @tahir-jamil,
The issue in the project is related to wrong image path. ~/ will points to the src folder. In this case, you should change the path from [src]="'~/images/' + item.img" to [src]="'~/app/images/' + item.img"

I had the same problem. Normally it wouldn't be a problem to figure out which directory is meant by "~" if there wasn't the confusing error message:

/data/data/org.nativescript.testingOne/files/app/images/chair.png (No such file or directory)

it looks like it's looking at the right place but still can't find it...
@tsonevn Thank you for the tip. Now I can even reference the assets folder ;-)

Thank You, Thank You, Thank You ..... :-)

Thank you....

Was this page helpful?
0 / 5 - 0 ratings