Hi and hope someone may be able to help.
I'm writing an app that is based on some original artwork and I'm wanting to store several large (Adobe Illustrator) files in the same folder as the app's package. Because these files are large I don't want them to be included when I get to the stage of exporting the app to an apk file.
Traditionally I'd use the assets folder for this but the contents of this folder would get compiled into the apk file.
Does anyone have any suggestions for folders that won't get compiled in the export process.
My thanks
Related
For example i have an android program which contains important files in the assets folder , can the user who installed the apk access the assets folder or not ? for hacking purpose
Anyone can open your .apk just by changing the extension to .rar, what you can do to protect your code is releasing it using proguard rules, but still in that case an image for instance in the drawable folder can be compromised, however an string in your strings.xml is bit more protected.
Anyone can decompile your app and can see a lot of things including your assets. .apk file is just an compressed file which can be extracted easily.
I have some files that I want to read from my app.Currently, I have to do the following:
Check if the file exists in the files directory.
If it doesnt, then copy the files from assets to the files directory
If it does, then, skip step 2
So, is it possible to not copy the files ? This increases the size of my app (uselessly) as there is an extra copy of all the files.
Note, that I have to access the file using getfiles(). I am using a library that doesnt work if I give the uri of my assets folder.
So, it it somehow possible to compile the app with some files already in the files directory ?
Internal storage for you app is created when application is installed so there is no way to provide files there during compile time, that would be magic.
You could try creating ContentProvider for sharing your files stored inside assets folder.
Besides, you should tell which library you are using. Then I may be able to suggest something more precise.
I want to add a text file to my APK root. This file will not be used in the application but it will stay there for manual extraction of the APK.
I tried to put it into the root of the project in Eclipse but it didn't include that file in the APK. I don't want to put it into assets folder. Can't I put it to the root?
Use the assets folder.
According to Android developer
assets/
This is empty. You can use it to store raw asset files. Files that you save here are compiled into an .apk file as-is, and the original filename is preserved. You can navigate this directory in the same way as a typical file system using URIs and read files as a stream of bytes using the AssetManager. For example, this is a good location for textures and game data.
Files that are not put into any of the main directories of your android project will NOT be included in your apk. You MUST put the file in the assets so it can be accessed within the application as an external resource/file.
I'm pretty new to eclipse and Android and I'm trying to add some files to the assets folder, but certain files and directories are not being included in the .apk file.
I have set-up the following structure in the solution:
/assets
/textures
/test.png
/splash.png
/xml
/testData.xml
I don't know if there is a specific way to get eclipse to re-build/compile the project and add the new assets to the assets folder in the .apk, but the /xml subfolder (and its contents) are not in the apk. Subsequently I get FilenotFoundExceptions thrown when I deploy the app. The textures are all included.
How can I force a recompile and rebuild of the apk and is there anywhere to manually check which files are included in the project (like an assets manifest file)?
As far as I know there are no restrictions placed on hierarchy or file formats for within the assets folder. Also, when I dragged the files from the desktop to the solution explorer, I selected 'copy files to project'.
Thanks
It appears one cannot use upper-case letters in the naming of files within the assets folder. Contrary to my example above, I was actually using camel-backed file names within the folders. After changing the file names to lower-case, the apk was automatically re-built with the assets the next time I deployed
I am analyzing an APK, and see a set of .txt resources in the /res/raw/ directory of the application. After installing the application on an emulator, I would expect to see those same files in the /data/data/[app]/files directory, but they do not seem to exist. Where are the raw resources stored? Are raw resources generated at application runtime somewhere else on the filesystem? Or when they are accessed, is it dynamically from the local .apk file? Thanks.
Raw resources (and really, all resources) are bundled in the APK file (this includes files placed in assets/), which is why you cannot get to the using File handles. The APK files themselves usually live in the system/app directory of the device.
The internal storage location you mentioned (/data/data/[app]/files) is where files created with Context.openFileInput(), Context.openFileOutput(), or Context.getFilesDir() are placed.
HTH