I tried to decompile the apk with apktool, modify it a bit, and re-build the apk.
Here is what I've tried:
apktool d viber.apk
res/xml/android_backup_rules_api31.xml
and res/xml/android_backup_rules.xml
apktool b viber
... and step 3 cannot proceed because of the error below:
W: /Users/<USERNAME>/Desktop/APK_RE/viber/AndroidManifest.xml:1076: error: '@2114715648' is incompatible with attribute theme (attr) reference.
W: /Users/<USERNAME>/Desktop/APK_RE/viber/AndroidManifest.xml:1077: error: '@2114715648' is incompatible with attribute theme (attr) reference.
W: /Users/<USERNAME>/Desktop/APK_RE/viber/AndroidManifest.xml:1078: error: '@2114715648' is incompatible with attribute theme (attr) reference.
W: /Users/<USERNAME>/Desktop/APK_RE/viber/AndroidManifest.xml:1083: error: '@2114846720' is incompatible with attribute resource (attr) reference.
W: error: failed processing manifest.
brut.androlib.exceptions.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/var/folders/rt/1rw6721917xbtnmtznd812hx3873hr/T/brut_util_Jar_79656065772315295564857961138440605910.tmp, link, -o, /var/folders/rt/1rw6721917xbtnmtznd812hx3873hr/T/APKTOOL17872764973844080976.tmp, --package-id, 127, --min-sdk-version, 21, --target-sdk-version, 33, --version-code, 651217, --version-name, 21.3.2.0, --no-auto-version, --no-version-vectors, --no-version-transitions, --no-resource-deduping, --allow-reserved-package-id, --no-compile-sdk-metadata, -e, /var/folders/rt/1rw6721917xbtnmtznd812hx3873hr/T/APKTOOL13620375907382818829.tmp, -0, arsc, -I, /Users/<USERNAME>/Library/apktool/framework/1.apk, --manifest, /Users/<USERNAME>/Desktop/APK_RE/viber/AndroidManifest.xml, /Users/<USERNAME>/Desktop/APK_RE/viber/build/resources.zip
... and I checked associated lines (i.e., 1076, 1077, 1078, 1083), and noticed that:
<activity android:exported="false" android:name="com.snap.camerakit.LegalPromptActivity" android:theme="@2114715648"/>
<activity android:exported="false" android:name="com.snap.camerakit.LegalPrePromptVariantGActivity" android:theme="@2114715648"/>
<activity android:exported="false" android:name="com.snap.camerakit.diagnostics.DiagnosticsExportActivity" android:theme="@2114715648"/>
...
<meta-data android:name="com.android.vending.splits" android:resource="@2114846720"/>
They all comes with this @+digits string. I thought this was some decoding error, so I checked the original APK with ClassyShark.jar, and they look like:
<activity
theme='@res/0x7E0C0000'
name='com.snap.camerakit.LegalPromptActivity'
exported='false'>
</activity>
<activity
theme='@res/0x7E0C0000'
name='com.snap.camerakit.LegalPrePromptVariantGActivity'
exported='false'>
</activity>
<activity
theme='@res/0x7E0C0000'
name='com.snap.camerakit.diagnostics.DiagnosticsExportActivity'
exported='false'>
</activity>
...
<meta-data
name='com.android.vending.splits'
resource='@res/0x7E0E0000'>
</meta-data>
Why are these fields filled with hex digits? Is there any way I can fix them, or can I ignore them? (I don't really care about these functions actually, and I only want to do some backup tests as you can see in step 2)
Robert's answer in the comments worked:
Remove associated attributes
Build the apk
Use some zip utility (e.g. 7z) to extract the original AndroidManifest.xml
and replace the same file in re-built apk