Java – Reload APKs and create custom applications

Reload APKs and create custom applications… here is a solution to the problem.

Reload APKs and create custom applications

Whether you can create a new APK by reloading/overwriting an existing APK.

For example, we have WhatsApp Messenger. Now, if I want to display a notification like “Person X is online” in the notification area, I can’t use my existing WhatsApp Messenger. So I wanted to develop a new custom messenger that uses all the features of WhatsApp Messenger plus some of my custom code. Just like importing a JAR, we can import an APK… Is it??

It seems to be using someone else’s work, but only from the point of view of learning, I want to know the possibilities. So far, let’s put aside all security vulnerabilities.


In short, no.

APKs are not like jar files, you can simply import them into your app. They also contain other resources, such as XML and Assets. The code is saved in the classes.dex file, which is generated from the jar file where the code is applied.

In addition, each application runs in its own DVM and is sandboxed to prevent this interaction between applications. You can’t simply use WhatsApp’s code for your own app as a third-party app.

However, there are two ways to achieve what you want.

  1. If your target app provides APIs through a content provider or web service, you can use those APIs to access its data and events, such as user onboarding. WhatsApp does not provide any such API
  2. You decompile the target application and insert your own code to do what you want. This can be very difficult, as most popular apps like WhatsApp obfuscate their code, making it difficult (but not impossible) to decipher. In addition, WhatsApp uses AES to encrypt most of its data like messages, contacts, chat threads, etc., which adds an extra layer in some places to bypass. Oh, and if you do, you’ll also be violating multiple intellectual property and copyright laws.

Related Problems and Solutions