[Android Themes] Raiz:
V-Recompile

​

You've done the hardest part, now what's left is repacking that thing together.

A)How to recompile:

​

It’s pretty simple, do it with apktool with this command:

apktool b [nameoftheapk].apk
​

You can add several options, here’s the full list.

The -c option to me is the most useful, because it allows to leave the signature unchanged for system apks. It’ll be deprecated soon (APKtool v2.6.0), so you’ll have to do the trick manually.

What -c (--copy-orginal) does: “Copies original AndroidManifest.xml and META-INF folder into built apk. Scheduled for deprecation.”

A bit of details, good to know:

“META-INF contains apk signatures. After modifying the apk it is no longer signed. You can use -c / --copy-original to retain these signatures. However, using -c uses the original AndroidManifest.xml file, so changes to it will be lost.”

And

“After [d]ecode, there will be new folders (original / unknown) in the decoded apk folder

original = META-INF folder / AndroidManifest.xml, which are needed to retain the signature of apks to prevent needing to resign. Used with -c / --copy-original on build

unknown = Files / folders that are not part of the standard AOSP build procedure. These files will be injected back into the rebuilt APK.”

Apktool uses aapt2, the tool used in Android Studio to compile your app. You can learn more on what it is here.

B)Troubleshooting:

​

First, remember that you can use aapt1 (used by default) and aapt2 when recompiling, try both if you run into some issues with the first.

If you have an issue with APKtool's dummy values, go on the Github Issue I opened, the problem is now solved.

Most common error, and simple to solve are the following:

-

Name of the file not written correctly

:​

brut.directory.DirectoryException: java.nio.file.NoSuchFileException: Firefoxr

Solution: The correct name is Firefox not Firefoxr, how dumb can I be?

​

-

Aapt errors:

(here a folder isn’t recognized):​

W:invalid resource directory name: /Users/Raiz/Desktop/apktool/Firefox/res navigation

Solution: Use aapt2, the folders not recognized are because aapt1 (used by default) is older than aapt2, so if you see an error like this, use the option “—use-aapt2”

​

-Xml Errors:

​

W: /Users/Raiz/Desktop/apktool/framework-res/res/values/styles.xml:1185: error: Resource entry Theme.Holo already has bag item textEditSuggestionItemLayout.

Solution: These errors are quite easy to fix, just go to the file at the line mentioned then fix the error. Usually it a doubled line, a synthax error, …

Unfortunately APKtool isn’t able to correct string typos, it’s up to you to write in correct English (definitely struggling with that on my side lol).

For other more specific errors, copy/pasting the error message in the google search bar will most certainly redirect you to a Github error, or a post in The Official APKtool XDA Thread. You can find answers by searching, so search thoroughly before asking, it’ll save you some time.

And what is troubleshooting without

[UNIVERSAL][LOGCAT]How to get & read a logcat/ Troubleshoot your own issues!

by @Stryke_the_Orc​

Credit for this part:

APKtool issues on Github

The APKtool documentation

@iBotPeaches for this amazing tool