2

I am trying to patch one .apk and I've found that you can do it using
apktool d your.apk
then patch smali files
apktool b com.your.package patched.apk
and finally jarsign it with debug key

The problem is that smali files are hard to read
I found great online tool: javadecompilers.com, which outputs java code.

My problem is that, after patching my app decompiled with this tool, I don't know how to build proper .apk from it. I have tried just zipping it, changing extension from .zip to .apk and then signing it with jarsigner, but after uploading it to phone with
adb install patched.apk
It tells me
Failure [INSTALL_FAILED_INVALID_APK]
Probably this zipping and changing extension is wrong, but how to do it properly? Thanks.

  • There is a big difference between disassembled code and decompiled code. Ofter decompiled code is not precise, prone to errors and can't be recompiled back. I suggest you to learn a bit of smali and use apktool to patch your app. – Luca D'Amico Apr 24 '18 at 11:04

1 Answers1

0

Either you work with apktool and .smali files, or you can attempt to do what you are already trying to but it is not always going to work especially for more complex apks because there is a higher chance that it won't be decompiled cleanly

You will need an environment or ide to compile the modified source code back to an apk.

  1. Copy the source into your own ide (e.g Android Studio)
  2. Add the resources and androidmanifest
  3. Modify what you wish to
  4. Compile

You can use jadx or dex2jar for offline tools, or the online you already are (though i have no experience with that online tool)

Niraeth
  • 315
  • 2
  • 4
  • Yeah, I thought about copying decompiled sources into the Android Studio, but is seems a bit cumbersome to be honest. Isn't there any command line tool which could to this? – gimmieanswersplox Apr 24 '18 at 20:42
  • 1
    I am not aware of any tool that does that, so i think the only option for you is to copy/add the code manually into the ide. – Niraeth Apr 26 '18 at 02:05