I'd like to inject a jar library into an apk file to use it from smali code.
Here's what I did:
- Unpackaged the apk
apktool d -f -r app-debug.apk
- Copied the jar file to the
/libs
directory of decompiled project Added the call to my library to the main activity on create hook like this:
invoke-static {p0}, Lcom/example/injection/Inject;->test(Landroid/content/Context;)V
Repacked the apk
apktool b .
- Sign the generated apk using
jarsigner
- Then I install the app from
/dist/
dir usingadb install app-debug.apk
The app installs sucessfuly, but instantly crashes. On each crash the logcat outputs following message:
4-14 00:37:45.397 3016-3162/? I/logserver: extract_appname, forward search, appname=com.example.ben.myapplication
04-14 00:37:45.397 3016-3162/? I/logserver: get_fault_appname, appname=com.example.ben.myapplication
04-14 00:37:45.400 3016-3161/? I/logserver: handle_notify_event, send msg [submit:trigger=0,bugtype=2,modulename=com.example.ben.myapplication,level=1,testtype=NORMAL,path=/data/log/unzip/ALE-L21_ALE-L21C432B584_0000000000_20180414003745_crash,mode=1;]
04-14 00:37:45.688 23691-23691/com.example.ben.myapplication I/Process: Sending signal. PID: 23691 SIG: 9
I run this on device , so I can't really access the crash report, but It's obviously because the com/example/injection/Inject
is not found.
I've done injection before, but instead of adding jars I added the smali classes into the project, but I would like to try and add jar libs instead. Is there a way to do this?