Multiple substitutions in non-positional format - Oxygen OS #1360

Closed
avi-vish opened this Issue Nov 4, 2016 · 3 comments

Projects

None yet

2 participants

@avi-vish
avi-vish commented Nov 4, 2016 edited

Hi.. I'm trying to make a few changes to my SystemUI.apk (Oxygen OS 3.2.7, Marshmallow 6.0.1). The framework-res.apk decompiles and recompiles just fine . The SystemUI.apk decompiles but throws the following error during recompiling ..

C:\apktool>apktool -c b SystemUI
I: Using Apktool 2.2.1
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
W: warning: string 'drag_to_add_tiles' has no default translation.
W: warning: string 'keyguard_plugged_in_dash_charging' has no default translation.
W: warning: string 'notification_content_disable_button' has no default translation.
W: warning: string 'notification_content_disable_button_in_nav' has no default translation.
W: warning: string 'notification_title_disable_button' has no default translation.
W: warning: string 'notifications_off_text' has no default translation.
W: warning: string 'notifications_off_title' has no default translation.
W: warning: string 'qs_edit' has no default translation.
W: warning: string 'quick_settings_buttons_label' has no default translation.
W: warning: string 'volume_footer_no_disturb' has no default translation.
W: warning: string 'volume_footer_ring' has no default translation.
W: warning: string 'volume_footer_slient' has no default translation.


W: C:\apktool\SystemUI\res\values-fa\plurals.xml:8: error: Multiple substitutions
    specified in non-positional format; did you mean to add the formatted="false"
      attribute?
W:
W: C:\apktool\SystemUI\res\values-fa\plurals.xml:8: error: Found tag </item> where </plurals> is expected
W:
W: C:\apktool\SystemUI\res\values-th\plurals.xml:8: error: Multiple substitutions 
	specified in non-positional format; did you mean to add the formatted="false"
	  attribute?
W:
W: C:\apktool\SystemUI\res\values-th\plurals.xml:8: error: Found tag </item> where </plurals> is expected
W: Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.
	AndrolibException: brut.common.BrutException: could not exec (exit code = 1  ): [C:\Users\
	  Avinash\AppData\Local\Temp\brut_util_Jar_4013670714821373130.tmp, p,
		--forced-package-id, 127, --min-sdk-version, 23, --target-sdk-version, 23, --version-code,
			23, --version-name, 6.0.1, -F, C:\Users\Avinash\AppData\Local\Temp\APKTOOL4914359995357466782.tmp, -0, arsc, -0, arsc, -I, C:\Users\Avinash\AppData\Local\apktool\framework\1.apk, -S, C:\apktool\SystemUI\res, -M, C:\apktool\SystemUI\AndroidManifest.xml]
        at brut.androlib.Androlib.buildResourcesFull(Androlib.java:478)
        at brut.androlib.Androlib.buildResources(Androlib.java:412)
        at brut.androlib.Androlib.build(Androlib.java:311)
        at brut.androlib.Androlib.build(Androlib.java:264)
        at brut.apktool.Main.cmdBuild(Main.java:227)
        at brut.apktool.Main.main(Main.java:84)
		
Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could not
    exec (exit code = 1): [C:\Users\Avinash\AppData\Local\Temp\brut_util_Jar_4013670714821373130.tmp,
	   p, --forced-package-id, 127, --min-sdk-version, 23, --target-sdk-version, 23, --version-code, 23, --version-name, 6.0.1, -F,
    	 C:\Users\Avinash\AppData\Local\Temp\APKTOOL4914359995357466782.tmp, -0, arsc, -0, arsc, -I,
 		   C:\Users\Avinash\AppData\Local\apktool\framework\1.apk, -S, C:\apktool\SystemUI\res,-M, 
		      C:\apktool\SystemUI\AndroidManifest.xml] 
	    at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:439)
        at brut.androlib.Androlib.buildResourcesFull(Androlib.java:464)
        ... 5 more
		
 Caused by: brut.common.BrutException: could not exec (exit code = 1): [C:\Users\Avinash\AppData\Local\Temp\brut_util_Jar_4013670714821373130.tmp,
      p, --forced-package-id, 127, --min-sdk-version, 23, --target-sdk-version, 23, --version-code,23, --version-name, 6.0.1, -F, C:\Users\Avinash\AppData\Local\Temp\APKTOOL4914359995357466782.tmp, -0, arsc, -0, arsc, -I, C:\Users\Avinash\AppData\Local\apktool\framework\1.apk,-S, C:\apktool\SystemUI\res, -M, C:\apktool\SystemUI\AndroidManifest.xml]
        at brut.util.OS.exec(OS.java:95)
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:433)
        ... 6 more
@iBotPeaches
Owner

Wow haven't had a substitution error in years.

W: /home/ibotpeaches/Downloads/Apktool/Bug1360/SystemUI/res/values-fa/plurals.xml:8: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?
W: /home/ibotpeaches/Downloads/Apktool/Bug1360/SystemUI/res/values-fa/plurals.xml:8: error: Found tag </item> where </plurals> is expected
W: /home/ibotpeaches/Downloads/Apktool/Bug1360/SystemUI/res/values-th/plurals.xml:8: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?
W: /home/ibotpeaches/Downloads/Apktool/Bug1360/SystemUI/res/values-th/plurals.xml:8: error: Found tag </item> where </plurals> is expected

This is the offending line

        <item quantity="other">ใส่รหัส PIN ของซิม %1$d คุณเหลือจำนวนครั้งในการลอง %2$d ครั้งก่อนที่จะต้องติดต่อผู้ให้บริการเพื่อปลดล็อค ใส่รหัส PIN ของซิม %d คุณเหลือจำนวนครั้งในการลอง %d ครั้ง</item>

As you can see we have two positional substitutions of %1$d and %2$d, but then we have two non positional %d and %d. The character parser must be messing up.

@iBotPeaches iBotPeaches changed the title from Oxygen OS (MM) SystemUI.apk recompile error. to Multiple substitutions in non-positional format - Oxygen OS Nov 17, 2016
@iBotPeaches
Owner

Same exact pattern (this time in English) for #1405

<item quantity="other">%1$s, %2$s, and %d other friends like this page.</item>

So the 3rd qualifier is being missed.

@iBotPeaches iBotPeaches added a commit that closed this issue Jan 13, 2017
@iBotPeaches Add support for 3 non-positional attributes
 - fixes #1360 & fixes #1405
 - add tests
b60db09
@iBotPeaches iBotPeaches added a commit that referenced this issue Jan 13, 2017
@iBotPeaches changelog update for #1360 45c6beb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment