Apktool: "apktool.yml" package info is not used while build

Created on 22 Nov 2015  路  4Comments  路  Source: iBotPeaches/Apktool

hi,
i have patched the codes all around my code and also changed the application folder structure for my new packge from: com.appName.App
to: com.NewappName.App

so i have added in the "packageInfo" inside of the "apktool.yml"
packageInfo:
cur_package: com.NewappName.App
orig_package: com.NewappName.App

after creating an APK file i now again "decompile" the new generated APK and i see that the ApkTool 2.0.2 still created the folder structure of the old "\com\appName\App" and didn't updated it to a new
"\com\NewappName\App"

am i missing something ?

All 4 comments

The functionality in apktool.yml is used for handling

       Rewrite the manifest so that its package name is the package name
       given here.  Relative class names (for example .Foo) will be
       changed to absolute names with the old package so that the code
       does not need to change.

Since some applications are built with this, we identify this so we can rebuild using the same parameter. This functionality is not meant for what you are attempting to do.

If you want to blanket change the package name you will have to:

  1. Change the apktool.yml (like you did)
  2. Update the AndroidManifest.xml package name to the new value.
  3. Manually update the smali from (old/foo/bar to new/foo/bar) in terms of the directories
  4. Find and replace ALL *.smali files with the old package name Lold/foo/bar and replace with Lnew/foo/bar.

@iBotPeaches Thank you for this step-by-step guide on changing the package name.
However, it seems a bit outdated. Thereby I have several questions I would like to ask:

  • I didn't find any cur_package and orig_package references in the source code.
    Does this mean that the step 1 should be omitted?
  • Newer Apktool versions produce the unknown/ directory.
    Its structure is similar to the smali/ directory.
    Considering this, do I also need to update its catalog structure as in step 3?
  • If I decode the resources, do I also need to replace occurrences in the underlying *.xml files as in step 4?

@qminds, @iBotPeaches had provided a great guide that's not necessarily outdated as much as it being a more of a "General Guide" in nature.

There's so many variables to consider now days with Apps that either requires additional steps (and such) as well as many of them have one or more forms of security features that makes it extremely difficult and, in most of those cases, impossible to do without the Source Code.

I've learned allot, regarding various topics, to include changing the package name. This involved ALLOT of research, reading, trial & error, etc...

The following link is to unique guide that is very helpful in what your trying to do...

https://forum.xda-developers.com/showthread.php?t=2760965

... which is the best way I can personally help you in this topic. I may understand much of this, but I really don't do it very much at all myself.

I wish you the best of luck! :-)

~Ibuprophen

@Ibuprophen Thanks for your feedback.

The linked website describes the same aciton sequence as provided by @iBotPeaches.

I understand that there are different security tricks in applications used to prevent from changing the package name. However, both of these guides are dated 2014-2015, therefore some steps seem be outdated according to the current Apktool source code (e.g., see the step 1 in my message) and its updated decoding techniques.

That is why I'm humbly asking @iBotPeaches for brief clarifications on this topic.

Was this page helpful?
0 / 5 - 0 ratings