I have an apk file. I create other android project. I place the apk file within that project. Is it possible to access the Activities in the apk from within the new project (similar to importing classes in a jar)?
You cannot link one APK into another. You can either include the sources and resources from it (perhaps as an Android library project) to access its contents directly, or you can require that the user install it as well and you can invoke its intents.
Related
I have one android myLibrary.jar file. But myLibrary.jar file will load the native 3 different so file. I have a.so, b.so and c.so.
When i using in my own application, it just simply put the jar file to the Android Dependencies and all 3 so files put in the libs/armeabi of the main application package.
When deploy and install on the device, these so file will be in the data/data/my-appname/lib/*.so.
Now i need to provide the sdk solution. The user side doesn't want the main application. They just want the myLibrary.jar. So i am considering about packing all 3 *.so files to the jar. I searched for the how to add to the so files to myLibrary.jar. But i still don't understand.
In this following post:
[Ant]How to add .so file into a jar and use it within jar(set the java.library.path)?
It mentioned about adding the so file to the jar and extract at runtime. But i still don't understand how to achieve that.
After trying that mentioned in the following post:
Creating a product SDK: How do I add a native lib (.so) and a jar with the SDK I am creating?
After my sample application reference the the compiled jar that included the .so file. After installing to the device, the libs/armeabi/xxx is not unpacked on the install. So i would like to know how to extract them dynamically and save them to data/data/my-appname/lib/ so that i can use with System.loadlibary(.so).
Thanks a lot.
Let's say I have an Android Project set up and a git repository for it. Where can I put my keystore (and other sensitive files) inside my project so I can be guaranteed that it will not end up inside the .apk when I export the app (but will be inside the git repository)?
For instance, I can't put sensitive files inside the assets folder because that will end up inside the .apk.
Is there a place to store these kind of files in the Android file hierarchy I am missing?
Don't put your keystore anywhere in your source control or project folder even if you have .gitignored it. It is a personal document, to be treated as you would your SSH keys.
It is better to keep it in an external location, such as your documents folder or personal keystore folder, which you manage yourself. As you have mentioned, these don't need to end up in the APK so they are purely supporting documents and files.
Is there a place to store these kind of files in the Android file hierarchy I am missing?
Put them in the project root. The only file from the project root that is incorporated directly into the APK is AndroidManifest.xml, and even that is moving with the new build system and project directory structure.
Or, create some other directory that does not collide with any existing directories and will not be used by Android, like _stuff/.
Or, have your project itself be in a subdirectory, putting other related files in a peer directory.
Also, make sure you set up your .gitignore properly such that files only go into the Git repo that you actually want in the Git repo.
I have created an application on android, referring the "android-support-v4.jar" while compiling my application, so I want to know whether the generated apk will be bundled with the "android-support-v4.jar" or not?, If it gets bundled with the jar file then how can I ensure whether it is bundled or not?
Yes it will be bundled.
The classes you use from android-support-v4.jar have to be part of your .apk in the end. If they are not your app will crash because it refers to code that does not exist. If the app works you have successfully included it.
Edit: there is no .jar in the apk. The support classes are directly embedded with your classes into classes.dex.
I am developing an application for Titanium, and therefore building a module from an Android application. But a module for Titanium generates a project in Android which has no autogenerated R file.
I need to load a bitmap image but as I dont have the R file so I cant access to my resources by the id. I have thought about accessing to this bitmap by path..But also struggling to do that, as I have read about something like in the Android .apk doesnt have folders...Dont really understand it to be honest.
Can I have a folder in my Android project and access to files on it with some path like #folder/resource/item.png? Then store it in an InputStream for example.
Thanks a lot.
David.
We just recently added support in git (our master branch) for bundling a "res" folder with your Titanium module. If you grab a new build, you should be able to put your "res" folder under "platform" in your module, and it everything there will be automatically bundled in your app.
To access the resources under Res (since the R.java is generated for the app and not the module), we have a helper class called TiRHelper that gives you access to any resource in your module like so:
int xyz = TiRHelper.getApplicationResource("id.xyz")
The Native Code of the Android application is going alone with application as lib file in the APK file. Suppose if I want to share a native code between two different applications, Is there any trick avail apart from the below:
Adding the lib with every application
Copy the lib in to system/lib folder and dynamically link it with application. (If we build just only the applications then we cannot use this).
You can't copy anything onto /system unless you are root, so I'd suggest you just include your native library in every application that needs it.
You must create library project ant than create your activity and lib.so file. You may be added all project this library.(Such as vitamio)