Hex patcher

Hex patcher is a developer option added in App Cloner 2.4. It is available to users with the huge or giant donation since the option could also be used to change the app’s package name and generate any number of clones.

The option allows hex-based search & replace operations on arbitrary files contained inside the APK, whether DEX files, resource files or any other files.

The option shows a text editor where you can enter (or paste) one or more hex patches. Each hex patch must be separated by an empty line and itself consists of 3 or 4 lines:

  1. An optional comment line starting with # or //. This may describe what the patch does.
  2. The path and name of the file to which the patch should be applied. Wildcards are allowed, e.g. you can use *.dex to apply the patch to all DEX files, e.g. classes.dex, classes2.dex, etc.
  3. The search bytes as hex values. Each by must be separated by a single space.
  4. The replace bytes as hex values. Each by must be separated by a single space. The length of the search and replace bytes must be the same.

Tap the plus icon in the toolbar to open an editor to add a hex patch in the correct format. Tap the edit icon to edit the hex patch where the cursor is currently located. You can use the menu to delete the hex patch at the current cursor location or to reset / clear all hex patches, effectively disabling the option.

The search and replace bytes may contain ?? or ** to represent wildcard bytes. In the search bytes they will match any byte. In the replace bytes they will be skipped (no replacement will be made). You may also use ? or * in the upper or lower part of a byte to match nibbles or half-bytes, for example 0? would match a byte from 00 to 0F.

You may also use the patterns $0, $1, etc. until $F, which in the search bytes will match any byte (exactly like ??) but also remembering the matched byte’s index 0, 1, etc. In the replace bytes you can use $0, $1, etc. to reference and include the matched byte. This allows moving bytes to different positions within the pattern without changing them.

In the replace bytes you may also use S0, S1, etc. until SF. This will set the upper nibble (half-byte) to the value 0, 1, etc. For example, with S0 a byte 43 would become 03, with S1 a byte 04 would become 14.

Lastly, in the replace bytes you can use increments by writing +1, +2, etc. or decrements by writing -1, -2, etc.

All hex patches are processed in the order they appear. This means a hex patch may modify the result of a previous hex patch.

Use the Hex patcher option with great care. You’ll need to know what you’re doing, otherwise the clone could simply crash.