Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android assets - not all folders/files packaged in APK

I have problem with ASSETS folder in android. I put folders and files in ASSETS, and for some folders/files I got FileNotFoundException. Then I printed all folder/file names from ASSETS folder by code, and I saw that not all folders/files are packaged into APK. Why is that happening? All files and folders have names without special characters, example: "Prevoz tereta i lica vozilima/Prevoz tereta i lica vozilima.json"? For some files/folders it works, and for some it doesn't. Does anyone know how to solve this problem? Thanks in advance!

enter image description here

like image 245
VPetrovic Avatar asked Jan 17 '26 13:01

VPetrovic


1 Answers

I think I found solution for my problem. Files that needed to be in ASSETS folder were created on my desktop. I created ASSETS folder in Android Studio, but when I was putting files from desktop to assets I didn't put them via Android Studio but Windows Explorer instead. I found location of assets folder and pasted files there, so I think that Android Studio didn't index some of them. Now I created 4-5 files and folders via Android Studio (right click on assets folder -> new -> file/directory), and every one of them is packaged and working all right. So I think that was the problem and the solution. I will have to create every file and folder by hand in Android Studio, then just put data in those empty files afterwards. Thank you all for help/suggestions. I'm glad that I found the solution, even if it's stupid. I'll make this an accepted answer tomorrow, because stackoverflow doesn't allow me to do so until tomorrow.

like image 145
VPetrovic Avatar answered Jan 20 '26 05:01

VPetrovic



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!