Where does the lib-X folder come from in android app - android

Please help with a fast question.
We have an Android Application, and we added the tracking to see how the internal storage is used. Then we received a list of files & folders from the user's devices.
In that list, there is a bunch of lib-X folders in the app's data folder. The folder consumed a huge amount of user storage. They are named "lib-1", "lib-2", "lib-main", "lib-0", and on some devices it's just "lib" only.
If there are multiple lib-x folders, usually the lib-0 will be the biggest one and consume most of the storage.
I tried to reproduce it by installing the application on the same device but could not see them inside the storage.
I strongly believe it contains native libraries, but not sure how they are created.
Would you have any idea why/how the folder is created?
Thanks.

Related

Is it reliable to check for a certain structure in getFilesDir() directory in Android?

I'd like to check certain things in that directory to check user has not somehow accessed that directory and has changed something on his own.
In order to do that I'm excluding some files that services my app uses creates in that directory, like, for example realm database files or google maps config files. Code is prepared so that certain files would be excluded from raising that the user has modified something in the directory in his own.
Problem is that it looks like files are not always the same, for example in my physical device a new folder and 2 files that are not created in emulator get created.
If different files can be created depending on if you are using one device or another, then this is not going anywhere, and I'll have to think in another approach for the problem we need to make this check, but if the only difference is that only these files and folder appear in physical devices with the same name as the one I'm seeing, it would just be question of also excluding them.
So, what can I expect about the files created in that directory in physical devices?

Where does Android Studio store my compiled application?

I'm doing a practice application in which I do a CRUD in android studio 3.0.1 and I'm running the application directly on my cell phone.
The application works without any inconvenience but when I want to remove the BD in SQlite from the application to analyze the fields from my pc I can not find the directory associated with my application
And checked the memory of the cell where all the applications are and I can not find the folder associated with it.
Could you tell me if it is stored in some hidden directory or something, because I can not find the folder associated with my application?
Note: I also have an external memory in my cell phone which has been reviewed folder by folder but nothing.
And checked the memory of the cell where all the applications are and I can not find the folder associated with it.
You are looking at external storage. Your app will not have a directory there, unless you create one in your code.
Could you tell me if it is stored in some hidden directory or something
Your APK is not stored anywhere that a user can see, except perhaps on a rooted device.
I also have an external memory in my cell phone which has been reviewed folder by folder but nothing
That is removable storage. Your app will not have a directory there, unless you create one in your code.

Duplicating offline OSMdroid app resource files?

I am currently developing an offline app with OSMDroid and I'm starting to ask myself some questions about the storage space the app is going to take.
Previously we had the MBTiles and the database stored at the root of the internal memory and we installed it apart from the app, but we judged it insecure and inconveniant.
Now, the files are compiled with the app and are installed on start-up in the private folder of the app itself.
Here's my question, does it mean that technically both files are duplicated because there is one version compiled in the app and one in the internal memory, thus taking more storage space?
Is there a better solution for this?
After multiple attempts to find a standard way to not duplicate the resources files, I found that I will have to use expansion files.
According to https://developer.android.com/google/play/expansion-files.html, APK files may not exceed 100MB, after that limit you have to use expansion files that will be downloaded with the installer from the play store.
Expansion files are already in a reachable location for OSMdroid so no need to copy them in the app's private folder.
However since my app might be for a restricted-public only and installation will be done manually, I thought of building a separate app that will install the app + expansion files to give less hassle to my clients.

Start Android app with files on sdcard or somewhere in the filesystem

I making an application with phonegap/cordova where I need to keep a lot of files up to date. Some files (mainly images) will need to be erased in time, and some new ones will get downloaded. The thing is, in Android, to manipulate those files, it seems I need to have them on the sdcard; so I copy the files the app starts with from my assets folder to the sdcard. It just seems like a waste of memory space.
Do you know if is there anyway I can start with the app having those files the app starts with already inside the sdcard? or at least somewhere I can delete them later?
Thank you.
Files that are delivered to the device as part of your APK will be stored in a form that cannot be modified by your application (other than by updating to a new version of the apk).
If you copy the files out of the APK into the private internal storage area or the external storage area, those copies can be modified, but the originals inside the apk will remain.
The most efficient solution may be to not put these files in your apk, but have your app instead download them separately on the first run, using whatever mechanism you wanted to use to change them in the future.
(Some people object to this feeling that such files are less secure against unauthorized use, but as the contents of an .apk are trivial to extract this is not a strong argument. Needing to maintain a server to download from is a slightly more substantial objection.)
You do not need to store the files on the SD Card. Each app has its own internal storage that is not accessible by any other apps. For more information see the official docs: http://developer.android.com/guide/topics/data/data-storage.html

Pre-populated databases in Android: Trying to put the pieces together

I have been gathering information in this site and others about the best way to include a pre-populated sqlite database in Android. I just would like to confirm that I understood the reasons of why something that should be trivial… it is not.
So could someone please tell me if my following conclusions are correct or wrong?:
the main reason many people suggest copying a pre-populated database file from the assets folder to "/data/data/YOUR_PACKAGE/databases/" is because there is no way to access a database file in the assets folder or doing that would be overly complex (?). (Could someone clarify which of these two answers is the right one ?)
another important reason database files in the assets folder must be copied somewhere else is because files in that location cannot be updated. Then even if a database in the assets folder could be open, this would be useful only if such database does not have to be modified.
UPDATE: I launched a new thread focussing only on this issue: Opening a read only database directly in the assets folder.
files in the assets folder can be only 1 Mb size (unless they have certain file extensions such as mp3). Note that this restriction is not relevant if: your database is smaller that 1 Mb, or you do not mind dividing your database in 1 Mb chunks and putting them together at runtime, or you do not mind distributing a database file with a mp3 extension.
If the database file is copied from the assets folder to "/data/data/YOUR_PACKAGE/databases/", there is no way to delete the original database file at the assets folder to avoid having a duplicated file. This is also because files in the assets folder cannot be modified.
Making the puzzle a bit more complex: I found in the comments to the accepted answer of this question: Ship an application with a database
that copying the database from the assets folder to another location in fact does not work on some devices running 2.3+. Is that accurate ? If that is true, then the best alternative would be to download the database file from the web at first run ?
Thanks for any clarification.
You're essentially confusing apks with actual folders on your device.
Think of an apk as an install package - not unlike the msi of the Windows world. The whole goal of this install package is to securely authenticate and deliver code and resources to your device. In a naive implementation, you would then unpack said code to a read-only location, the resources somewhere read-writeable and be on your merry way.
To save space, Android is a bit smarter - the code and resources never leave the signed archive, so you always know it's the ones you put in and you don't waste space by storing the code twice. There's some real magic going on in the class loader that also allows it to unzip classes on the fly but that's besides the point.
So, essentially, everything in this compressed install package is read-only (by virtue of also being signed). It's your job to be the "installer" and move whatever resources you need to a read-writeable location. Of course, you can't touch the apk once it's in place since that would allow for malware and defeat the whole purpose of the signing.
Hope this clears the confusion.

Categories

Resources