I have an APK generated from eclipse which contains a native library packaged inside the APK.
I start a service when BOOT_COMPLETED is received. Normal version of SO file and APK runs fine.
I had setup the debug environment and tried to debug this app and native code.
Now the problem is if i install this through ADB install my.pack.age.app it gets copied to data/app and then i dont get the BOOT_COMPLETED Intent.
When i manually put this apk to system/app folder i get unsatisfied linker error as library not found. It is searching in path data/data/my.pack.age.app/lib.
I have the debug version of native library generated with gdbserver file and other gdb.setup and other things are setup properly for debugging.
How can i debug this apk while installing in the /system/app folder?
PS: Modifying the Packages.xml and packages.list by hand and changing the path of native library is not in my option as it would require every time to modify that file & may get corrupt installation.
I found the problem, For system APKs that are bundled with Device from OEM,
You have to put the library in System/lib folder for all the APk in system/app folder.
I was putting it packaged inside the APK.
Related
I need to run my busybox from a Java Android app. To do this, I included a tar archive with busybox in apk res and unpack it to /data/data/com.exeample.test/files with permissions 755. But I can't run it from this location (permisiion denied).
The question arises, how to install binary files through the apk package in general? The question is very interesting due to the very thoughtful security of Android.
I will be very grateful for your help.
Ready-made binary executables are distributed only inside the apk package in the apk /lib/<ABI> directories (Taken from https://dvelopers.android.com). Otherwise, it will be at least very difficult to execute native code in Android. In the apk package, the /lib/<ABI> directories can contain files with different extensions, this is not limited. In order for the files to be unpacked when installing the apk package, you must set android:extractNativeLibs=true in the manifest (https://developer.android.com/guide/topics/manifest/application-element#extractNativeLibs).
For Android Studio users, you can create directories
app/src/main/jniLibs/<ABI> - for *.so files
app/src/main/resources/lib/<ABI> - for all other files including *.so.*
then they will be packaged in the /lib/<ABI> directories of the apk package.
From an android application, the path to the native library dir can be obtained by calling getApplicationInfo().nativeLibraryDir.
I have a third-party apk that I'm trying to optimize, as the developer couldn't be bothered with such petty things.
The application is built with Xamarin and contains AOT assemblies. Is there a way to strip them from the apk without completely reverse-engineering the project and building it anew?
Removing AOT assemblies from an .apk is as easy as deleting them and correctly re-signing the package.
Here are the steps:
Open the .apk as zip file, delete lib\<architecture>\libaot-*.so files.
Xamarin apps include libmonodroid.so and libmonosgen-2.0.so even without AOT compilation, don't touch those.
Delete META-INF from root of the .apk.
Sign the resulting .apk using jarsigner from the JDK. If you don't have the original key, any will do, you will just lose the ability to update the app automatically.
Don't forget to align the .apk with zipalign from Android build tools.
Resulting thinner app installs and runs perfectly, but will, of course take a couple of seconds longer to launch.
I'm trying to modify the Androidmanifest.xml for the browser on my device so that I can execute an app by loading a URI in the browser.
I've been running around the file system in ADB SHELL all day, but can't seem to find it. Plus there is no FIND, nor LOCATE command on the system.
You can theoretically find the Androidmanifest.xml file in the APK.
Every APK contains the compiled source code of the application. There is no useable decompiler for APKs at the moment so it is not possible to change the content of one.
In addition to the compiled code and the other resources of the application, an APK also contains a signature from the developer, which will become invalid when the content is changed to verify the source of an APK. An Android system won't install an APK with an invalid signature, so even if you could change the content of the APK, you still couldn't use it.
The conclusion: You cannot do what you are trying to do.
Android Studio on Windows 10/11, it’s in: app/src/main.
I have a webkit plugin apk (just like the sample BrowserPlugin under development/samples). I want to integrate it into the system.img. I build it as the preload apk in /system/app/, but when the phone boot up, the apk is not installed properly.
If I install the apk in /data/app/ manually, it works well.
when the apk in /system/app/, the .so inside the apk can not be extracted to /data/data//lib/
Anyone know how to integrate the webkit plugin as a preload apk on Gingerbread, please kindly help me.
Thanks
.so file should be merged to the system.img separately. If it's a browser plug-in, it should be copied to /system/lib/plugins/<package_name>
It looks like there's no mechanism in android to extract .so file from an apk file that contains .so files if it's integrated with the system.
I am facing problem in creating the .apk file using the ant script . The generated .apk named as _unaligned.apk instead of .apk and on installing the _unaligned.apk file to the device I get force-close showing the java.lang.VerifyError exception, but the same apk generated using IDE works fine. I am struck on this for a long time. Can you share the build.xml file that generates the .apk file?
this Bloq entry explains all necessary steps. Especially if you want to customize your build script.
If your are looking for the actual build script, just look into your Android SDK folder platforms/android-X/templates. There should be a file called android_rules.xml.
I customized my build script to clean, build, sign and distributing the apk to an attached device. If you like, I can provide you with my script. Just contact me!
You'll need to use zipalign & sign your apk with some key; as long as you're testing the app you can simply use the debug key with ant debug
At least that's what I understand from this page which you may want to read carefully.
What ant command are you running at the command / terminal prompt?
I have been having different problems with manually running ant (Repackage apk file to contain custom assets what build tool to use) and there might be some info on that thread to help you.
Alternatively, remember that one needs to sign the apk file before deploying it (see Joubarc's link).