I tried repackaging an Android app but after installation, when I launch that app, the app crashes immediately. This is the exception I am getting when I decompile this application using apktool and rebuild this application using apktool irrespective of any modifications done at the smali level or not.

exalvxhzn.█: 01
at exalvxhzn.▃.─(Unknown Source:68)
at exalvxhzn.▃.━(Unknown Source:0)
at java.lang.Runtime.nativeLoad(Native Method)
at java.lang.Runtime.loadLibrary0(Runtime.java:1014)
at java.lang.System.loadLibrary(System.java:1669)
at exalvxhzn.╿.│(Unknown Source:43)
at exalvxhzn.┇.─(Unknown Source:13)
at exalvxhzn.┇.━(Unknown Source:24)
at exalvxhzn.┇.━(Unknown Source:6)
at androidx.core.app.CoreComponentFactory.<clinit>(Unknown Source:0)
at java.lang.Class.newInstance(Native Method)
at android.app.LoadedApk.createAppFactory(LoadedApk.java:229)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:733)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:812)
at android.app.LoadedApk.getResources(LoadedApk.java:1034)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2357)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5821)
at android.app.ActivityThread.access$1200(ActivityThread.java:200)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1673)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6810)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)

When we launch an app, the flow of execution is

application sub-class constructor -> applications sub-class onCreate() ->launcher's activity onCreate() method.

I tried few code injections at the starting of the onCreate() as well as at the constructor level. The code injections, I did is regarding

  • Insertion of Toast message
  • A basic file creation at the internal storage (After installing , I gave the storage permission before launching the app)

I know that there are some anti-repackaging techniques which is applied on the app which resists repackaging. My questions are about:

  1. Even if an app has depolyed some anti-repackaging technqiues, then even if I am inserting a code (Toast message/file creation) at the beginning of Application's sub-class onCreate() method, then also shall I be able to see impact of the code modifications? For e.g. Will I be able to see my Toast messages or the file creation at the internal storage?
  2. Can I apply anti-repackaing technique, if I am only having the apk and not the source code?Like for e.g consider I have an Amazon apk, can I apply anti-repackaging technique on the Amazon apk?
  3. When we decompile an application, at smali level, which is the 1st function which gets executed when the app is launched?
  4. Is it like by applying an anti-repackaging technique, then instead of onCreate(), some other method gets called first when we open the app?
  5. Why the above exception is coming even if I haven't done any code modifications at the smali level?
  6. At Smali level, which is the constructor which gets called first, is it the static constructor or non-static constructor?

It will be a big help if someone could give their valuable inputs on this. Thanks!!

  • Can you provide the apk you're trying to repack? Have you tried repacking another apk to make sure that your problem is in the apk and not with your process?
    – MikeSchem
    Nov 2, 2020 at 22:14
  • @MikeSchem Thanks for your response. Yes, I have already tried repackaging various apps which is there over the playstore and I have successfully created and used the repackaged version properly. The apk which I am trying to repack is there over the playstore and I fetched that apk through adb pull commands. Nov 3, 2020 at 3:07


You must log in to answer this question.

Browse other questions tagged .