I included several pre-made .png files in my assets folder, but only some of them are getting through without error:
AssetManager assetManager = context.getAssets();
Inputstream in = assetManager.open(assetName);
where assetName
is a String
containing something like "myPic.png".
It seems to work for some of the files, but for others it throws java.io.FileNotFoundException: myPic.png
even though I see it right there in the Assets folder alongside plenty of other files that seem to be making the cut.
To view asset files in Files home, select Libraries and then select Asset Library . To view and edit asset files in Setup, enter Asset Files in the Quick Find box, then select Asset Files. Click the name of a resource to view its details.
An Asset Definition file is an optional XML file that you can use to import assets into SiteProtector. The Asset Definition file provides a complete list of information about an asset, including information that you specify in the New Asset window, such as Criticality, Function, and OS version.
Create an assets folder in your project's root folder. In Android Studio you can right click the Project outline and go to New > Directory. You can create another subfolder for text files in assets if you like. But if you do, you have to include the relative path in pubspec.
Apparently closing / reopening the project in Android Studio was enough to get it to work correctly. No idea why it wasn't noticing all the assets in the first place, but now it does after restarting.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With