[UTIL][NOV 24, 2022] Apktool - Tool for reverse engineering apk files

Search This thread

clewis.it

Senior Member
Nov 1, 2006
351
174
Hi. I have a very specific problem with rebuilding an app. I am modifying some ./res/layout/ files to expand the length of some text fields. Literally, the only thing I'm doing is changing android:maxLength="12" to android:maxLength="25". After I make this change, rebuild, sign and replace the apk on my phone, it acts as if the application was deleted. Logcat only tells me the application was removed.

I'm using the latest apktool (2.7.0). I have already made significant changes to other parts of the app to allow screen rotation, added extra values to a field using res/values/arrays.xml, and changed and added smali code. All of these changes resulted in a working app. It's only when I change this one attribute that the problem occurs.

Any ideas what can be causing this problem? I know it's not user error. I do the same thing each time. Build the app with apktool, sign it with platform keys, transfer it to my phone, remove old apk, set permissions 0644. This has worked every time, including on my previous builds. Reading some of the other issues, I have also replaced using the same file name, and zipaligned the apk. both of these had no effect on the apks with modified field lengths. Also, if I changed the field lengths back to original, it works again, so like I said, it's a very specific issue.
ugh, nevermind. I did make a mistake after zipaligning and forgot to remove the old apk. the zipaligned apk works. forget I said anything.
 

jakefeiwin

New member
Feb 3, 2023
1
0
In the latest releases, does the size of your apk bloats when you decompile and compile it?

If so how much?

and are there any alternatives?
 

timkre

Member
Nov 12, 2021
7
1
Been using apktool here for a bit. It has decompiled the APK fine but when I go to build it I get these errors below. I have tried to build it without any changes and it still gives these errors. Any ideas to try?

Code:
I: Using Apktool 2.7.0
I: Checking whether sources has changed...
I: Checking whether resources has changed...
I: Building resources...
W: C:\Users\User\Downloads\platform-tools_r33.0.3-windows\platform-tools\apktool\kcteleservice\res\values\styles.xml:966: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Animation.Material.Activity'.
W:
W: C:\Users\User\Downloads\platform-tools_r33.0.3-windows\platform-tools\apktool\kcteleservice\res\values\styles.xml:999: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/CarBody2'.
W:
W: C:\Users\User\Downloads\platform-tools_r33.0.3-windows\platform-tools\apktool\kcteleservice\res\values\styles.xml:1056: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/CarBody2'.
W:
W: C:\Users\User\Downloads\platform-tools_r33.0.3-windows\platform-tools\apktool\kcteleservice\res\values\styles.xml:1269: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/TextAppearance.Holo.Light.Widget.Button'.
W:
W: C:\Users\User\Downloads\platform-tools_r33.0.3-windows\platform-tools\apktool\kcteleservice\res\values\styles.xml:1391: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Preference.SeekBarPreference'.
W:
W: C:\Users\User\Downloads\platform-tools_r33.0.3-windows\platform-tools\apktool\kcteleservice\res\values-v26\styles.xml:6: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Preference.SeekBarPreference'.
W:
W: C:\Users\User\Downloads\platform-tools_r33.0.3-windows\platform-tools\apktool\kcteleservice\res\values\styles.xml:1405: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Preference.Material.SwitchPreference'.
W:
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [C:\Users\User\AppData\Local\Temp\brut_util_Jar_7427372970184973815882706761418219510.tmp, p, --forced-package-id, 127, --min-sdk-version, 23, --target-sdk-version, 26, --version-code, 28, --version-name, 9, --no-version-vectors, -F, C:\Users\User\AppData\Local\Temp\APKTOOL6993516853265231877.tmp, -e, C:\Users\User\AppData\Local\Temp\APKTOOL9162820534918758109.tmp, -0, arsc, -I, C:\Users\User\AppData\Local\apktool\framework\1.apk, -S, C:\Users\User\Downloads\platform-tools_r33.0.3-windows\platform-tools\apktool\kcteleservice\res, -M, C:\Users\User\Downloads\platform-tools_r33.0.3-windows\platform-tools\apktool\kcteleservice\AndroidManifest.xml]
W: C:\Users\User\Downloads\platform-tools_r33.0.3-windows\platform-tools\apktool\kcteleservice\res\values-v26\styles.xml:10: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Preference.Material.SwitchPreference'.
W:
W: C:\Users\User\Downloads\platform-tools_r33.0.3-windows\platform-tools\apktool\kcteleservice\res\values\styles.xml:1406: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Preference.PreferenceScreen'.
 

Thebear j koss

Senior Member
Been using apktool here for a bit. It has decompiled the APK fine but when I go to build it I get these errors below. I have tried to build it without any changes and it still gives these errors. Any ideas to try?

Code:
I: Using Apktool 2.7.0
I: Checking whether sources has changed...
I: Checking whether resources has changed...
I: Building resources...
W: C:\Users\User\Downloads\platform-tools_r33.0.3-windows\platform-tools\apktool\kcteleservice\res\values\styles.xml:966: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Animation.Material.Activity'.
W:
W: C:\Users\User\Downloads\platform-tools_r33.0.3-windows\platform-tools\apktool\kcteleservice\res\values\styles.xml:999: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/CarBody2'.
W:
W: C:\Users\User\Downloads\platform-tools_r33.0.3-windows\platform-tools\apktool\kcteleservice\res\values\styles.xml:1056: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/CarBody2'.
W:
W: C:\Users\User\Downloads\platform-tools_r33.0.3-windows\platform-tools\apktool\kcteleservice\res\values\styles.xml:1269: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/TextAppearance.Holo.Light.Widget.Button'.
W:
W: C:\Users\User\Downloads\platform-tools_r33.0.3-windows\platform-tools\apktool\kcteleservice\res\values\styles.xml:1391: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Preference.SeekBarPreference'.
W:
W: C:\Users\User\Downloads\platform-tools_r33.0.3-windows\platform-tools\apktool\kcteleservice\res\values-v26\styles.xml:6: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Preference.SeekBarPreference'.
W:
W: C:\Users\User\Downloads\platform-tools_r33.0.3-windows\platform-tools\apktool\kcteleservice\res\values\styles.xml:1405: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Preference.Material.SwitchPreference'.
W:
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [C:\Users\User\AppData\Local\Temp\brut_util_Jar_7427372970184973815882706761418219510.tmp, p, --forced-package-id, 127, --min-sdk-version, 23, --target-sdk-version, 26, --version-code, 28, --version-name, 9, --no-version-vectors, -F, C:\Users\User\AppData\Local\Temp\APKTOOL6993516853265231877.tmp, -e, C:\Users\User\AppData\Local\Temp\APKTOOL9162820534918758109.tmp, -0, arsc, -I, C:\Users\User\AppData\Local\apktool\framework\1.apk, -S, C:\Users\User\Downloads\platform-tools_r33.0.3-windows\platform-tools\apktool\kcteleservice\res, -M, C:\Users\User\Downloads\platform-tools_r33.0.3-windows\platform-tools\apktool\kcteleservice\AndroidManifest.xml]
W: C:\Users\User\Downloads\platform-tools_r33.0.3-windows\platform-tools\apktool\kcteleservice\res\values-v26\styles.xml:10: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Preference.Material.SwitchPreference'.
W:
W: C:\Users\User\Downloads\platform-tools_r33.0.3-windows\platform-tools\apktool\kcteleservice\res\values\styles.xml:1406: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Preference.PreferenceScreen'.
You need to update your framework resources.
 

timkre

Member
Nov 12, 2021
7
1
I made my changes and built the apk again successfully. Now when trying to install I get the error below about no certificates. Any ideas? Do I need to sign the APK? I am not familiar with signing APK's.

Code:
C:\Users\User\Downloads\platform-tools_r33.0.3-windows\platform-tools>adb install kcteleservice_4810.apk
Performing Streamed Install
adb: failed to install kcteleservice_4810.apk: Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES: Failed to collect certificates from /data/app/vmdl1884586152.tmp/base.apk: Attempt to get length of null array]
 

Thebear j koss

Senior Member
I made my changes and built the apk again successfully. Now when trying to install I get the error below about no certificates. Any ideas? Do I need to sign the APK? I am not familiar with signing APK's.

Code:
C:\Users\User\Downloads\platform-tools_r33.0.3-windows\platform-tools>adb install kcteleservice_4810.apk
Performing Streamed Install
adb: failed to install kcteleservice_4810.apk: Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES: Failed to collect certificates from /data/app/vmdl1884586152.tmp/base.apk: Attempt to get length of null array]
What is the app? Is it a system app? Need to check how original signatures are set up. Test key signing may not work. If system app may need to install as system app. There are way too many variables to know what you need to do.
 

Aqq123

Senior Member
Aug 27, 2009
288
346
Google Nexus 4
Nexus 7
I made my changes and built the apk again successfully. Now when trying to install I get the error below about no certificates. Any ideas? Do I need to sign the APK?
Yes, any APK you install needs to be signed.

However for system apps you can use the -c (--copy-original) flag to apktool to keep the original signature. It no longer matches the contents but it doesn't matter as it's not checked. As long as there is a signature.

In fact if you change the signature on a system APK such as TeleService it might break functionality. Since certain system components are supposed to share the same signature. So unless you want to re-sign the whole system, -c is the way to go (as long as you're not modifying the manifest).
 

timkre

Member
Nov 12, 2021
7
1
Yes, any APK you install needs to be signed.

However for system apps you can use the -c (--copy-original) flag to apktool to keep the original signature. It no longer matches the contents but it doesn't matter as it's not checked. As long as there is a signature.

In fact if you change the signature on a system APK such as TeleService it might break functionality. Since certain system components are supposed to share the same signature. So unless you want to re-sign the whole system, -c is the way to go (as long as you're not modifying the manifest).
I am wanting to modify the manifest to force a downgrade to an older version of the app. So therefore the -c option won't retain those changes. Am I correct on that? Or is there a better way to change the version number of the app so the system will accept the downgrade?
 

okp2023

New member
Mar 28, 2023
1
0
There's an issue when decompiling some resources. That what get in Manifest after apktool using:
<activity android:name="com.mxtech.videoplayer.mxtransfer.ui.folder.FolderActivity" android:screenOrientation="portrait" android:theme="@2098003976"/>

And this is the result of using ApktoolM:
<activity
android:theme="@com.mxtech.videoplayer.ad.transfer_bundle:style/Light_7d0d0008"
android:name="com.mxtech.videoplayer.mxtransfer.ui.folder.FolderActivity"
android:screenOrientation="portrait" />
 

Top Liked Posts