Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apk tool unable to Re-compile apps having Newer Pattern #2220

Closed
mikesew1320 opened this issue Nov 6, 2019 · 5 comments
Closed

Apk tool unable to Re-compile apps having Newer Pattern #2220

mikesew1320 opened this issue Nov 6, 2019 · 5 comments

Comments

@mikesew1320
Copy link

@mikesew1320 mikesew1320 commented Nov 6, 2019

Information

  1. Apktool Version (apktool -version) - 2.4.0
  2. Operating System (Mac, Linux, Windows) - Android
  3. APK From? (Playstore, ROM, Other) - XDA, GitHub and Play store (Magisk and ADM and MiXplorer)

Apktool 2.4.0 can decompile any app but it can't recompile them after decompiling even without modifying nothing. I think It's fron the resources folder and by file names that contains special characters like _(underscore)

I tried with older application and apktool 2.4.0 works fine

Is it possible to fix this issue?

Stacktrace/Logcat

WARNING: linker: Warning: unable to normalize ""
W: /storage/emulated/0/Download/magisk_src/res/values/public.xml:60: error: Public symbol array/0_resource_name_obfuscated declared here is not defined.
W: /storage/emulated/0/Download/magisk_src/res/values/public.xml:61: error: Public symbol array/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f080001 declared here is not defined.
W: /storage/emulated/0/Download/magisk_src/res/values/public.xml:62: error: Public symbol array/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f080002 declared here is not defined.
W: /storage/emulated/0/Download/magisk_src/res/values/public.xml:63: error: Public symbol array/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f080003 declared here is not defined.
W: /storage/emulated/0/Download/magisk_src/res/values/public.xml:64: error: Public symbol array/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f080004 declared here is not defined.
W: /storage/emulated/0/Download/magisk_src/res/values/public.xml:65: error: Public symbol array/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f080005 declared here is not defined.
W: /storage/emulated/0/Download/magisk_src/res/values/public.xml:66: error: Public symbol array/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f080006 declared here is not defined.
W: /storage/emulated/0/Download/magisk_src/res/values/public.xml:67: error: Public symbol array/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f080007 declared here is not defined.
W: /storage/emulated/0/Download/magisk_src/res/values/public.xml:68: error: Public symbol array/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f080008 declared here is not defined.
W: /storage/emulated/0/Download/magisk_src/res/values/public.xml:69: error: Public symbol array/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f080009 declared here is not defined.
W: /storage/emulated/0/Download/magisk_src/res/values/public.xml:70: error: Public symbol array/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f08000a declared here is not defined.
W: /storage/emulated/0/Download/magisk_src/res/values/public.xml:71: error: Public symbol array/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f08000b declared here is not defined.
W: /storage/emulated/0/Download/magisk_src/res/values/public.xml:72: error: Public symbol array/0_resource_name_obfuscated_APKTOOL_DUPLICATENAME_0x7f08000c declared here is not defined.
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/data/data/per.pqy.apktool/brut_util_Jar_7086418326799736223.tmp, p, --forced-package-id, 127, --min-sdk-version, 17, --target-sdk-version, 28, --version-code, 255, --version-name, 7.4.1-a6e62e07, --no-version-vectors, -F, /data/data/per.pqy.apktool/APKTOOL12611358589247348834.tmp, -0, arsc, -I, /data/data/per.pqy.apktool/1.apk, -S, /storage/emulated/0/Download/magisk_src/res, -M, /storage/emulated/0/Download/magisk_src/AndroidManifest.xml]
I: Using Apktool 2.4.0-Black
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether resources has changed...
I: Building resources...

Steps to Reproduce

  1. apktool

Frameworks

If this APK is from an OEM ROM (Samsung, HTC, LG). Please attach framework files
(.apks that live in /system/framework or /system/priv-app)

APK

If this APK can be freely shared, please upload/attach a link to it.

Questions to ask before submission

  1. Have you tried apktool d, apktool b without changing anything?
  2. If you are trying to install a modified apk, did you resign it?
  3. Are you using the latest apktool version?
@iBotPeaches

This comment has been minimized.

Copy link
Owner

@iBotPeaches iBotPeaches commented Nov 10, 2019

There is not much Apktool can figure out to do here. If the "key" part of "key/value" is gone, Apktool needs to make up some human readable name so it can process back into resourceIds. Android doesn't require that, so tools have an advantage to just strip information preventing exactly this (Apktool) from piecing it back together.

Do you have any ideas?

@lbalmaceda

This comment has been minimized.

Copy link

@lbalmaceda lbalmaceda commented Nov 13, 2019

I'm on the same situation.

When decompiling:

S: Could not decode file, replacing by FALSE value: font/gothamxnarrow_bold.otf
S: Could not decode file, replacing by FALSE value: font/gotham_bold.TTF
S: Could not decode file, replacing by FALSE value: font/gothamxnarrow_light.otf
S: Could not decode file, replacing by FALSE value: font/gothamlight.ttf
S: Could not decode file, replacing by FALSE value: font/gotham_light.TTF

Then when recompiling, without changing anything:

W: invalid resource directory name: /base/res font
Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/var/folders/xq/1wgltmrd6xj810wbchwsqxv00000gn/T/brut_util_Jar_7140640358525018502.tmp, p, --forced-package-id, 127, --min-sdk-version, 18, --target-sdk-version, 28, --version-code, 8, --version-name, 1.3.2b, --no-version-vectors, -F, /var/folders/xq/1wgltmrd6xj810wbchwsqxv00000gn/T/APKTOOL4887728976392554400.tmp, -0, arsc, -0, arsc, -I, /apktool/framework/1.apk, -S, /base/res, -M, /base/AndroidManifest.xml]
	at brut.androlib.Androlib.buildResourcesFull(Androlib.java:496)
	at brut.androlib.Androlib.buildResources(Androlib.java:430)
	at brut.androlib.Androlib.build(Androlib.java:329)
	at brut.androlib.Androlib.build(Androlib.java:267)
	at brut.apktool.Main.cmdBuild(Main.java:230)
	at brut.apktool.Main.main(Main.java:83)
Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/var/folders/xq/1wgltmrd6xj810wbchwsqxv00000gn/T/brut_util_Jar_7140640358525018502.tmp, p, --forced-package-id, 127, --min-sdk-version, 18, --target-sdk-version, 28, --version-code, 8, --version-name, 1.3.2b, --no-version-vectors, -F, /var/folders/xq/1wgltmrd6xj810wbchwsqxv00000gn/T/APKTOOL4887728976392554400.tmp, -0, arsc, -0, arsc, -I, /apktool/framework/1.apk, -S, /base/res, -M, /base/AndroidManifest.xml]
	at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:441)
	at brut.androlib.Androlib.buildResourcesFull(Androlib.java:482)
	... 5 more
Caused by: brut.common.BrutException: could not exec (exit code = 1): [/var/folders/xq/1wgltmrd6xj810wbchwsqxv00000gn/T/brut_util_Jar_7140640358525018502.tmp, p, --forced-package-id, 127, --min-sdk-version, 18, --target-sdk-version, 28, --version-code, 8, --version-name, 1.3.2b, --no-version-vectors, -F, /var/folders/xq/1wgltmrd6xj810wbchwsqxv00000gn/T/APKTOOL4887728976392554400.tmp, -0, arsc, -0, arsc, -I, /apktool/framework/1.apk, -S, /base/res, -M, /base/AndroidManifest.xml]
	at brut.util.OS.exec(OS.java:95)
	at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:435)
	... 6 more
@realityJie

This comment has been minimized.

Copy link

@realityJie realityJie commented Nov 14, 2019

Maybe you can comment addMissingResSpecs() method witch is called in ARSCDecoder class. I solved the problem with this method.

@JimDunn1234

This comment has been minimized.

Copy link

@JimDunn1234 JimDunn1234 commented Nov 17, 2019

@realityJie where and what file did you edit to add that addMissingResSpecs()? I would like to try that comment myself to see if it works for me.

@realityJie

This comment has been minimized.

Copy link

@realityJie realityJie commented Nov 17, 2019

@realityJie where and what file did you edit to add that addMissingResSpecs()? I would like to try that comment myself to see if it works for me.

https://github.com/iBotPeaches/Apktool/blob/17ad91da61ee12cce11baac73176547925e4dd8d/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ARSCDecoder.java
line 185.
I don't know if this will cause other problems, but I solved this problem by commenting out this method.

@mikesew1320 mikesew1320 closed this Jan 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.