Packing Hidden Asset Files

I put the ".nomedia" file in a folder to prevent detection of media files in the Android MediaScanner folder. I need to copy this folder (including ".nomedia") from the assets of the APK to the SD card (so other applications can use these media files, etc.). When I pack an APK in Eclipse, it does not pack a ".nomedia" file. Presumably, it detects this as a hidden file. Any ideas how to fix this? Is there a secret flag that I can use? I would like to avoid copying the folder and then manually creating the ".nomedia" folder, if possible.

+4
source share
2 answers

I know that this is already a few years after the question was asked, but I ran into this question, which I myself was looking for the same problem, and found a solution that worked for me, so I thought I would post it:

In your ant.properties "file for your project (create a new one if you don't have one) add these two lines:

# DO NOT ignore the .nomedia file in the assets directory! aapt.ignore.assets="!.svn:!.git:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*.scc:*~" 

This will remove “. *” From the default exclusion list, and therefore .nomedia will now be included in your resource directory inside your .APK.

+8
source

Assets are collected in the application, you can not see them through the file browser. You will need to access this folder from the code, and then copy it to the file system when you first start or install the application. Take a look at this example, it talks about a database file, but in general you want to do the same for ANY file that you put in assets, and want to go to the file system:

http://www.helloandroid.com/tutorials/how-have-default-database

+1
source

Source: https://habr.com/ru/post/1312335/


All Articles