I would like to separate my Android Java application from codec pack (a .so library), to be distributed separately as .apk (the main app doesn't require these codecs to work properly + there's licence clash). How do I do such thing? Is it at all possible?
Yes, many game developers do the following for .so and graphics data.
I am assuming you are familiar with NDK.
your app needs access to the SD
Once User installs your app start downloading your .so files into a location on the sdcard
load your .so dynamically and make call to the functions you require
Related
I am developing an Android application that has a NDK .so file which I need to iterate on and fix + improve.
The current workflow has me having to generate a APK and install it every iteration which updates a whole plethora of non NDK elements in the process really slowing things down.
The question is how could I access the installation folder of my own APK? I have both a rooted and unrooted device.
Is there some change I could make to install the app in an unprotected location for development purposes even. The installation data is my own application after all so feels like should be a way...
Help greatly appreciated :)
EDIT1:
I found Unity3D has some sort of patching mode, maybe this is a sign that with the correct ADB commands it may be possible... https://docs.unity3d.com/Manual/android-AppPatching.html
EDIT2: I found the location of the .so I am building in... checked on unrooted device and don't have permission.
If your app is not a native-only app (has a Java/Kotlin part) then your so library should be loaded at the moment using a call to System.loadlibrary(..).
What is interesting on this method is, that calls to this method are ignored if the library to be loaded has already been loaded. So if you modify the Java code of the development build of your app to manually load your library before the original loadLibrary call is executed you can end up with a different library loaded.
The only problem is that System.loadLibrary(..) does not accept a file-name or path as argument. But using System.load(..) which uses a full path as argument you should be able to specify a full path to a file e.g. in the app's data directory. That way you can replace the library as often as you want and then just restart the app to load the updated library.
Hi i am looking into an android development , as we all know when we build the project it makes an APK that is the whole program. but is it possible to make a an android project / APK that would be able to use external files to include more info into the project.
like say for example i have a list commands or functions in my list , but i dont want it to be added into my APK build , is it possible to use it externally?
i was curious because something like COC and other games after downloading it , then downloads extra data from the net , more into updates for the whole game.
how is this possible or is it possible to do , and use functions or source codes externally and not include it into the APK , and also the proper usage of it
Any Android App can connect to the Internet and save downloaded data files to use as they need, without requiring to include them inside the APK. Indeed, for many games (and other Apps having large data sets), it's a sensible option.
There are a couple of things to be aware of:
Android restricts where (on the filesystem) you can save files. And no matter where you save the files, the user can delete them at any
time. Your App should be able to cope with this.
The files should only ever be data files - not executable code. Attempting to
execute downloaded files is likely to put your users at risk
(depending on the permissions your App was installed with) and is also likely to get your App marked as malware.
You should read the Android documentation on Data Storage to learn a bit more about it.
I am facing a serious issue here. I built an android and iOS application. Now after I developed it completely and it is running seamlessly, I want it to be multilingual(both android and iOS). Is there any simplest method which I can use now to make both my android and iOS apps multilingual now. The .apk and .ipa files have already been prepared and the project is complete. Please help!!!!
You cannot modify your .apk and .ipa files to be multilingual. I mean, theoretically it's possible but it would be ludicrously difficult. If you are stuck with the .apk and .ipa files you have, then your task is extremely difficult, sorry.
You can modify the android and iOS projects (I am assuming they are separate projects) to provide multiple language versions of the resource files where your user text and images are stored, assuming that you correctly stored all text and images which get displayed to the user in resource files/folders.
For Android, see http://developer.android.com/training/basics/supporting-devices/languages.html
For IOS, see http://www.raywenderlich.com/64401/internationalization-tutorial-for-ios-2014.
I am currently porting a library from Linux to Android and I am having some trouble.
The lib has an extension system : it will look for all the files with a particular extension in the folder /usr/local/lib/{thelibname}/extensions/, check if they are dynamic libraries, and load them and call a handler if it is the case.
However, I don't think it is possible to tinker with the base filesystem folders in Android.
I looked into assets but they did not convince me, it looks like they are more intended for images, audio, etc...
Is there another way to embed some files in an .apk and load them afterwards by enumerating a DIR* and calling dlopen ?
The other possibility would be to put the extensions with the app data but I don't know if there is a standard path for this that I could hardcode in the lib, is there? And I don't how to put some stuff in the data at the installation of the apk ? (I use QtCreator for the generation of the APK)
Okay, I found another question which helped me to solve my problem :
How to integrate native runtime library with dlopen on NDK?
You can easily load extension libraries from anywhere in the file system, including shared folders like /sdcard/ and her children. Any app (and native libraries therein) can gain full read access to /sdcard/ with READ_EXTERNAL_STORAGE permission.
This way you can establish a folder where the extensions will be updated not necessarily by a single APK (note the changes for WRITE_EXTERNAL_STORAGE in KitKat).
If you want to deploy all extension libraries as part of the APK, it's easiest to put them in the standard folder that is used to pack the APKs (for ADT, it's ${project_root}/libs/armeabi) and then they will be automagically installed in /data/app-lib/${app_package}. This approach allows to prepare an APK for multiple architectures, preparing appropriate files in ${project_root}/libs/x86, etc.
Note that all libraries must have lib prefix and .so suffix, so e.g. mylib.so or libcrypto.so.6 will not work, even though theoretically such libraries can be loaded by dlopen().
Your app has read access to the /data/app-lib/${app_package} directory, so you can scan it either from C code, or from Java. In Java, its easy to resolve the ${app_package} even if you don't want to hardcode this name. Simply call getApplicationContext().getPackageName().
In C, you can use /proc/${pid} to find the full path to your shared library, and this way you will also know the path to the extensions.
I'm developing an Android application. I'm very new on Android development.
I see on other projects that textures are hold on res directory. They have to be compiled and deployed into device.
I'm wondering if I can download a picture as a texture from a web service and use it.
I don't know if every media that I need has to be compiled.
Thanks.
Yes you could download the pictures from the web and use them. If you plan on having changeable content then you should probably do so as well.
Adding Images to Res will have them included in the APK and, Then copied to the device on installation (Unless you use zipalign which should sometimes allow you to use content from the apk)