What is the best place to place Android?

I want my Android application to download the .so file (the built-in library compiled by me) according to the functions of the device at runtime, so apk size will be small since I will not populate apk with many different versions of my own library.

I could not find a suitable place to download this library. Where is the preferred and recommended directory for this. Therefore, can I use the System.loadLibrary function for fast and safe loading?

+6
source share
1 answer

If you unzip apk, you will see that there is a lib folder in the root directory. This directory also exists in your application directory /data/data/package.name/lib as a symbolic link to /data/app-lib/package.name . If you really want to load your own libraries at runtime, one of them is where you would have to put them.

Since applications can get write permissions to their own data directory, you should be able to actually upload the file. ContextWrapper.getFilesDir() will return the path /data/data/package.name so that it does not transcode it.

Be careful with this - updating your own code yourself can be more of a problem than its value. If you're really trying to be safe, consider downloading and running arbitrary code in your application.

+2
source

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


All Articles