Fresco: can't open file in assets folder

Created on 27 Mar 2015  路  6Comments  路  Source: facebook/fresco

I tried SimpleDraweeView.setImageURI and set a file:///android_asset resource.

xx.setImageURI(Uri.parse("file:///android_asset/....jpg"));
But it shows an error:
can't open '/android_asset/xxx.jpg'
And if I use:
xx.setImageDrawable(new BitmapDrawable(getAssets().open("xxx.jpg")));
This is correct.
I am new to android. Do I make some mistakes? If there are some problems, please let me know. :-)

Most helpful comment

@quynhbk you are using UIL scheme. Fresco one doesn't have s (use asset://);

Fresco should support file:///android_asset/ instead of creating new scheme and don't documented clearly that asset:// scheme is vendor specific.

Picasso: https://github.com/square/picasso/issues/332
Glide: http://stackoverflow.com/questions/29982341/using-glide-for-android-how-do-i-load-images-from-asset-and-resources

All 6 comments

Thank you, IanChilds. Resolved.
I am sorry that I failed to reach the document.
I use:

Uri.parse("asset:///...")
and solved this problem.

No problem. Hope you find Fresco useful!

I can't load from:
newUrl = "assets://images/common/place_detail/default_place.png";
heap me!

@quynhbk you are using UIL scheme. Fresco one doesn't have s (use asset://);

Fresco should support file:///android_asset/ instead of creating new scheme and don't documented clearly that asset:// scheme is vendor specific.

Picasso: https://github.com/square/picasso/issues/332
Glide: http://stackoverflow.com/questions/29982341/using-glide-for-android-how-do-i-load-images-from-asset-and-resources

+1 to file:///android_asset/

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ykostova picture ykostova  路  3Comments

stevenmtang picture stevenmtang  路  3Comments

eldk picture eldk  路  3Comments

zewenwang picture zewenwang  路  4Comments

cococool picture cococool  路  4Comments