Solution: Shared Library Crash With Terminal - Android Software/Hacking General [Developers Only]

I was getting something like this error after compiling and integrating Term.apk and it's dependent libjackpal-androidterm3.so file in several 2.3 and newer ROMs:
UnsatisfiedLinkError: Cannot load library: reloc_library : unknown reloc type
It turns out that the libjackpal-androidterm3.so file in the apk was not the correct file to copy to /system/lib. I checked the source directory and in the /obj directory there was another libjackpal-androidterm3.so file that was much larger. I copied it to /system/lib and terminal works great. The file does get compiled during ndk-build; it is not pre-included with the source.
Usually I am able to copy library files directly from the apks. This apk was different for some reason. Anyway, I hope this helps someone.

Related

[Q] apk file parsing

Each and every android application is bundled as an apk file. When an apk file is installed different entites (files) of the application are stored in different parts of the system.
How can i find out where all the files of a particular application are stored inside the android file system? Is it the right way to parse apk file and find the places where all the parts of the app are stored?? Any ideas?
The apps .apk file should be in /data/app while the apps personal space with settings,configs etc. are in /data/data/packetname/
If it is preset to install to sdcard there is also /sdcard/Android/data
For files that get created on the /sdcard, there is no way of tracking/knowing what belongs to what app.

[Q] Simlink entire folder and giving permisions?

Hi
I want to include many applications in a rom I've created. The problem is that many of these apps wont work unless I extract the *.so files from inside the lib directory of the apk and copy those libraries to my rom (/system/lib) and give correct permissions (0-0-644).
Because these lib files are too big and taking large space from the system partition, I want to place them all in /data/data/lib directory and simlink this directory to /system/lib.
Can someone please provide the correct lines of code for the updeter-script to do that? How do I simlink entire directory? And how do I give correct permissions? Do I give permissions to the original directory (/data/data/lib) before simlinking, or do I give permissions to the virtual linked directory (/system/lib) after simlinking?
Thanks

Symlinked folder is treated as a file instead of a folder

Hello, using KatKiss 4.4.4 #35 i'm unable to get a symlink to work correctly from /storade/sdcard1/Android/data/<name of a package> (source) to /data/media/0/Android/data/<package name>.
The symlink do works from the path "/data/media/0/Android/data/<package name>" with a file explorer, but the reflected view on "/sdcard/Android/data/<package name>" is treated as a file by every applications, including the file manager that doesn't know what to do with that file (but correctly recognize this is a symlink and not a folder physically created here) and the software that require that folder (crash because it reconize it as a file and not a folder, as it use the "/sdcard" path and not the "/data/media/0/")
This is not a permission problem on the source folder side, changed to 777 it still doesn't work.
The problem is not specific to KatKiss, but i'm giving the information in case someone have a workaround that works only on a specific fork.
The only working workaround i found is using XPosed, redirecting the calls to the /storage/sdcard1 directly, but this solution is too aggressive, i'm unable to move only a subfolder of that package's folder, i'm forced to move everything.
The mountpoint workaround is dirty, i'd rather not use that if possible.
Regards, Magissia

[Completed] [Q] APK rebuild and install issues

I am learning how to mod Android apps.
I have rooted ASUS Transformer Prime for my experiments. It has busybox installed.
I have downloaded one of the games from /data/app directory, by copying it to sdcard and then using adb pull.
Then I have used apktool to disassemble apk and without any changes assembling it back. I did verify with Beyound Compare tool that resulting apk logically is same to original. All files inside are byte to byte same.
I ran zipalign on it.
Then I pushed it back to my device via adb push to sdcard and then copy it to /dev/app folder. restored permissions and owner.
When I tried to run the app I got the error, "Unfortunately application stopped".
The only difference between original and disassembled apk that I can see is that files inside the apk (which is zip) are in different order.
Can anyone shed the light on this problem? Does Android somehow remembered offsets of different files in that apk? Is there any log somewhere?
Thank you very much.
vasiliy_gagin said:
I am learning how to mod Android apps.
I have rooted ASUS Transformer Prime for my experiments. It has busybox installed.
I have downloaded one of the games from /data/app directory, by copying it to sdcard and then using adb pull.
Then I have used apktool to disassemble apk and without any changes assembling it back. I did verify with Beyound Compare tool that resulting apk logically is same to original. All files inside are byte to byte same.
I ran zipalign on it.
Then I pushed it back to my device via adb push to sdcard and then copy it to /dev/app folder. restored permissions and owner.
When I tried to run the app I got the error, "Unfortunately application stopped".
The only difference between original and disassembled apk that I can see is that files inside the apk (which is zip) are in different order.
Can anyone shed the light on this problem? Does Android somehow remembered offsets of different files in that apk? Is there any log somewhere?
Thank you very much.
Click to expand...
Click to collapse
Learned to use adb logcat.
Apparently app was failing because dalvik detected that timestamp on a dex file is different and decided that it should replace cached file in /data/dalvik-cache.
But that file is not writable for a group. Not sure why.

Replacing file in app data folder with binary identical file (same file) caused problem (protection/security?) - Solved

Scenario:
Fresh restore app from backup
Start app - if i don't touch anything app start normally
Fresh restored app from backup
Copy file from /data/data/XXX/files/my_file somewhere out (other directory)
Copy the same file back (overwrite original, files are binary same, same hash, just copy it back...)
App start with errors!
I checked permissions same as before... Compare files, hash, same as at the beginning ...
What is it? some "tamper" protection, security?
Redmi Note 9 Pro, Android 10, Security patch level 2021-04-01, MUI 12.0.5 Stable, Rooted, Magisk
Copying is not a good idea, because the application probably has its odex file. If you changed something in the apk file, the crash is obvious.
It's not APK file, its database (sqlite) ...
and i don't change anything, just copy file out, same file without changes copy back (overwrite original)
First i think about some CRC checks.. but problem persist if i copy the same file (same timestamp, same permission, same CRC)
Application somehow knows that i touch that file. But app it's not running, no child processes..
Sorry, I didn't pay attention that it didn't apply to apk. A database can be used by a service, not necessarily an application.
Try doing the same thing in TWRP.
So the correct answer to this problem was "SE Context" (SELinux)

Categories

Resources