[TOOL][WINDOWS][LINUX] MoKee OpenSource Theme Fixer v2

Status
Not open for further replies.
Search This thread

Ryuinferno

Senior Member
Apr 3, 2012
3,548
7,112
ryuinferno.github.io
If you are a MoKee OpenSource user, you will realise that the theme chooser is borked since MK43. Themes that used to work can't be used anymore, and if applied, the whole system will crash. A few months has passed since then, and now, we are glad to say that the solution is HERE AT LAST!!! :D

The Problem:
In MK43, we separated some parts of framework-res.apk into mokee-res.apk to ease development. However, this also broke theme chooser. Themes cannot find the resources they want to redirect anymore, but the weird thing is, certain themes could still function normally. So the long journey of debugging started, but no results....till recently, we found this:

https://code.google.com/p/tmobile-themes/wiki/NewGlobalThemeEngineDesign

The main point is at:
Resources are generated in the 0x0a package scope. This is designed to separate them in the AssetManager's ResTable. The framework currently uses 0x01 while application packages normally use 0x7f. The aapt tool was modified to support assigning arbitrary package scopes and so you must use the aapt tool found in the themes tree for building your own themes.

After decompiling a few problematic themes, res/values/public.xml was found to be populated with 0x02. The T-Mobile Theme Engine originally accepted only 0x0a, but CM made some changes so that others can be accepted as well. However, due to the major changes in MoKee, the changes lost its effect. Therefore, we have to revert to the default 0x0a. To achieve this, we need to recompile the theme APKs with custom made apktool and aapt.​

Requirements:
Must install JRE 1.7, you can get it here:

http://www.oracle.com/technetwor ... nloads-1880261.html

Windows users please follow this after installing: http://javarevisited.blogspot.co ... java-windows-7.html

Windows Tutorial:
1. Download mokee-theme-fixer_[version number]-windows.zip and extract the folder named "mokee" in it.
4CvJRH4.png


2. Open the "mokee" folder and you will see a few more folders. Place the APKs you want to fix into the folder named "input".
rIcg3NA.png


3. Run "mokee.bat" and let the magic happen! :D
fuPbJkk.png
J3SMUKV.png


4. If successful, the fixed APKs will be in the "output" folder, now named "done-[original name].apk".
vqUT6mG.png

Linux Tutorial:
1. Download mokee-theme-fixer_[version number]-linux.zip and extract the folder named "mokee" in it.

2. Open the "mokee" folder and you will see a few more folders. Place the APKs you want to fix into the folder named "input".

3. Execute "mokee.sh" and let the magic happen! (Remember to cd to that directory if using Terminal) :D

4. If successful, the fixed APKs will be in the "output" folder, now named "done-[original name].apk".​

Note:
1. The Windows version was developed and tested in Windows 8.1.
2. The Linux version was developed and tested in Ubuntu 12.04 LTS.
3. If you cannot execute the Linux version, please chmod 755 mokee/mokee.sh and mokee/tools/aapt.​

Credits:

Changelog:
Code:
[U]v1:[/U]
- Initial release

[U]v2:[/U]
- Fixed aapt not accepting uppercase letters and reduced size with strip and UPX
- Reduced size of Windows executables with strip and UPX

 
Last edited:

antutu

Senior Member
Nov 6, 2012
627
455
Got following error when try to convert hue theme, any idea?
Code:
--------------------------------------
MoKee OpenSource Theme Fixer v1
Copyright 2012-2014
--------------------------------------

--> Processing HueWhiteKat_4.4.apk... <--
I: Using Apktool 2.0.0-Beta8 on HueWhiteKat_4.4.apk
I: Loading resource table...
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: framework\1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Baksmaling...
I: Copying assets and libs...
I: Copying unknown files/dir...
I: Copying original files...
I: Using Apktool 2.0.0-Beta8 on HueWhiteKat_4.4.apk
I: Checking whether sources has changed...
I: Smaling...
I: Checking whether resources has changed...
I: Building resources...
res\xml\com_alensw_PicFolder.xml: Invalid file name: must contain only [a-z0-9_.
]
res\xml\com_alensw_PicFolder.xml: Invalid file name: must contain only [a-z0-9_.
]
res\xml\com_keramidas_TitaniumBackup.xml: Invalid file name: must contain only [
a-z0-9_.]
res\xml\com_keramidas_TitaniumBackup.xml: Invalid file name: must contain only [
a-z0-9_.]
res\xml\com_quoord_tapatalkHD.xml: Invalid file name: must contain only [a-z0-9_
.]
res\xml\com_quoord_tapatalkHD.xml: Invalid file name: must contain only [a-z0-9_
.]
res\xml\vStudio_Android_Camera360.xml: Invalid file name: must contain only [a-z
0-9_.]
res\xml\vStudio_Android_Camera360.xml: Invalid file name: must contain only [a-z
0-9_.]
res\xml\vStudio_Android_Camera360.xml: Invalid file name: must contain only [a-z
0-9_.]
Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.Androl
ibException: brut.common.BrutException: could not exec command: [tools\aapt.exe,
 p, --min-sdk-version, 16, --target-sdk-version, 16, --version-code, 31, --versi
on-name, 4.4, -F, C:\Users\XX\AppData\Local\Temp\APKTOOL4753921697499202546.tmp
, -x, 10, -I, framework\1.apk, -S, C:\mokeeThemeFixerv1\tmp\HueWhiteKat_4.4.apk\
res, -M, C:\mokeeThemeFixerv1\tmp\HueWhiteKat_4.4.apk\AndroidManifest.xml]
        at brut.androlib.Androlib.buildResourcesFull(Androlib.java:434)
        at brut.androlib.Androlib.buildResources(Androlib.java:362)
        at brut.androlib.Androlib.build(Androlib.java:285)
        at brut.androlib.Androlib.build(Androlib.java:258)
        at brut.apktool.Main.cmdBuild(Main.java:236)
        at brut.apktool.Main.main(Main.java:88)
Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could not
 exec command: [tools\aapt.exe, p, --min-sdk-version, 16, --target-sdk-version,
16, --version-code, 31, --version-name, 4.4, -F, C:\Users\XX\AppData\Local\Temp
\APKTOOL4753921697499202546.tmp, -x, 10, -I, framework\1.apk, -S, C:\mokeeThemeF
ixerv1\tmp\HueWhiteKat_4.4.apk\res, -M, C:\mokeeThemeFixerv1\tmp\HueWhiteKat_4.4
.apk\AndroidManifest.xml]
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav
a:470)
        at brut.androlib.Androlib.buildResourcesFull(Androlib.java:415)
        ... 5 more
Caused by: brut.common.BrutException: could not exec command: [tools\aapt.exe, p
, --min-sdk-version, 16, --target-sdk-version, 16, --version-code, 31, --version
-name, 4.4, -F, C:\Users\XX\AppData\Local\Temp\APKTOOL4753921697499202546.tmp,
-x, 10, -I, framework\1.apk, -S, C:\mokeeThemeFixerv1\tmp\HueWhiteKat_4.4.apk\re
s, -M, C:\mokeeThemeFixerv1\tmp\HueWhiteKat_4.4.apk\AndroidManifest.xml]
        at brut.util.OS.exec(OS.java:89)
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav
a:464)
        ... 6 more

Done if no errors above!
Press enter to exit...
Terminate batch job (Y/N)?
 

Ryuinferno

Senior Member
Apr 3, 2012
3,548
7,112
ryuinferno.github.io
Got following error when try to convert hue theme, any idea?
Code:
--------------------------------------
MoKee OpenSource Theme Fixer v1
Copyright 2012-2014
--------------------------------------

--> Processing HueWhiteKat_4.4.apk... <--
I: Using Apktool 2.0.0-Beta8 on HueWhiteKat_4.4.apk
I: Loading resource table...
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: framework\1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Baksmaling...
I: Copying assets and libs...
I: Copying unknown files/dir...
I: Copying original files...
I: Using Apktool 2.0.0-Beta8 on HueWhiteKat_4.4.apk
I: Checking whether sources has changed...
I: Smaling...
I: Checking whether resources has changed...
I: Building resources...
res\xml\com_alensw_PicFolder.xml: Invalid file name: must contain only [a-z0-9_.
]
res\xml\com_alensw_PicFolder.xml: Invalid file name: must contain only [a-z0-9_.
]
res\xml\com_keramidas_TitaniumBackup.xml: Invalid file name: must contain only [
a-z0-9_.]
res\xml\com_keramidas_TitaniumBackup.xml: Invalid file name: must contain only [
a-z0-9_.]
res\xml\com_quoord_tapatalkHD.xml: Invalid file name: must contain only [a-z0-9_
.]
res\xml\com_quoord_tapatalkHD.xml: Invalid file name: must contain only [a-z0-9_
.]
res\xml\vStudio_Android_Camera360.xml: Invalid file name: must contain only [a-z
0-9_.]
res\xml\vStudio_Android_Camera360.xml: Invalid file name: must contain only [a-z
0-9_.]
res\xml\vStudio_Android_Camera360.xml: Invalid file name: must contain only [a-z
0-9_.]
Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.Androl
ibException: brut.common.BrutException: could not exec command: [tools\aapt.exe,
 p, --min-sdk-version, 16, --target-sdk-version, 16, --version-code, 31, --versi
on-name, 4.4, -F, C:\Users\XX\AppData\Local\Temp\APKTOOL4753921697499202546.tmp
, -x, 10, -I, framework\1.apk, -S, C:\mokeeThemeFixerv1\tmp\HueWhiteKat_4.4.apk\
res, -M, C:\mokeeThemeFixerv1\tmp\HueWhiteKat_4.4.apk\AndroidManifest.xml]
        at brut.androlib.Androlib.buildResourcesFull(Androlib.java:434)
        at brut.androlib.Androlib.buildResources(Androlib.java:362)
        at brut.androlib.Androlib.build(Androlib.java:285)
        at brut.androlib.Androlib.build(Androlib.java:258)
        at brut.apktool.Main.cmdBuild(Main.java:236)
        at brut.apktool.Main.main(Main.java:88)
Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could not
 exec command: [tools\aapt.exe, p, --min-sdk-version, 16, --target-sdk-version,
16, --version-code, 31, --version-name, 4.4, -F, C:\Users\XX\AppData\Local\Temp
\APKTOOL4753921697499202546.tmp, -x, 10, -I, framework\1.apk, -S, C:\mokeeThemeF
ixerv1\tmp\HueWhiteKat_4.4.apk\res, -M, C:\mokeeThemeFixerv1\tmp\HueWhiteKat_4.4
.apk\AndroidManifest.xml]
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav
a:470)
        at brut.androlib.Androlib.buildResourcesFull(Androlib.java:415)
        ... 5 more
Caused by: brut.common.BrutException: could not exec command: [tools\aapt.exe, p
, --min-sdk-version, 16, --target-sdk-version, 16, --version-code, 31, --version
-name, 4.4, -F, C:\Users\XX\AppData\Local\Temp\APKTOOL4753921697499202546.tmp,
-x, 10, -I, framework\1.apk, -S, C:\mokeeThemeFixerv1\tmp\HueWhiteKat_4.4.apk\re
s, -M, C:\mokeeThemeFixerv1\tmp\HueWhiteKat_4.4.apk\AndroidManifest.xml]
        at brut.util.OS.exec(OS.java:89)
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav
a:464)
        ... 6 more

Done if no errors above!
Press enter to exit...
Terminate batch job (Y/N)?

Owh, that's caused by having capital letters in the package name...have to patch aapt for that but haven't found out how...:(
 

Fast-Droid

Senior Member
Feb 1, 2011
205
155
Manhattan
Worked for (Holo Glass Beta) theme on my Maguro..Thanks!!
 

Attachments

  • Screenshot_2014-01-06-11-21-20.jpg
    Screenshot_2014-01-06-11-21-20.jpg
    61 KB · Views: 2,614
  • Screenshot_2014-01-06-11-22-40.jpg
    Screenshot_2014-01-06-11-22-40.jpg
    90.9 KB · Views: 2,498
Last edited:
  • Like
Reactions: mathieuj

thuva06

Senior Member
Nov 18, 2013
239
52
Dubai
well can some one help me out here ?? pls

i followed each and every step ( theme chooser !!)
downloaded everything converted the file
and yes it was successful :)

but whats the actual procedure to replace the app??
i tried moving the new system app to /system/app folder it was successful
but when i go to settings and hit theme am getting unfortunately system stopped
also tried several reboots and also tried to delete the system Themechooser.apk
no use now cant even access my theme choose option
the part of converting files is perfect am assuming
bt transfer to mobile is causing me probs
thanks in advance
:)
 

Primokorn

Senior Member
Nov 17, 2012
11,471
7,718
I have several errors during the extracting process of mokee-theme-fixer_v2-windows.zip. I have Win7 64bits.
T5v7zFoe
 

varadinum

Senior Member
Sep 16, 2011
758
254
Graz-Budapest
Xiaomi Poco F3
  • Like
Reactions: akshay.mehta9

akshay.mehta9

Senior Member
Apr 7, 2013
333
98
Ahmedabad
I'm sorry, this theme does not work. The other theme function properly. I do not know why. [emoji780][emoji780][emoji780]

View attachment 2629603

Best regards







I'm sorry, this theme does not work. The other theme function properly. I do not know why. [emoji780][emoji780][emoji780]

View attachment 2629603

Best regards

no matter but which themes are working without recompile

Sent from my LG OPTIMUS 4X HD using Tapatalk Pro
 
Status
Not open for further replies.

Top Liked Posts

  • There are no posts matching your filters.
  • 34
    If you are a MoKee OpenSource user, you will realise that the theme chooser is borked since MK43. Themes that used to work can't be used anymore, and if applied, the whole system will crash. A few months has passed since then, and now, we are glad to say that the solution is HERE AT LAST!!! :D

    The Problem:
    In MK43, we separated some parts of framework-res.apk into mokee-res.apk to ease development. However, this also broke theme chooser. Themes cannot find the resources they want to redirect anymore, but the weird thing is, certain themes could still function normally. So the long journey of debugging started, but no results....till recently, we found this:

    https://code.google.com/p/tmobile-themes/wiki/NewGlobalThemeEngineDesign

    The main point is at:
    Resources are generated in the 0x0a package scope. This is designed to separate them in the AssetManager's ResTable. The framework currently uses 0x01 while application packages normally use 0x7f. The aapt tool was modified to support assigning arbitrary package scopes and so you must use the aapt tool found in the themes tree for building your own themes.

    After decompiling a few problematic themes, res/values/public.xml was found to be populated with 0x02. The T-Mobile Theme Engine originally accepted only 0x0a, but CM made some changes so that others can be accepted as well. However, due to the major changes in MoKee, the changes lost its effect. Therefore, we have to revert to the default 0x0a. To achieve this, we need to recompile the theme APKs with custom made apktool and aapt.​

    Requirements:
    Must install JRE 1.7, you can get it here:

    http://www.oracle.com/technetwor ... nloads-1880261.html

    Windows users please follow this after installing: http://javarevisited.blogspot.co ... java-windows-7.html

    Windows Tutorial:
    1. Download mokee-theme-fixer_[version number]-windows.zip and extract the folder named "mokee" in it.
    4CvJRH4.png


    2. Open the "mokee" folder and you will see a few more folders. Place the APKs you want to fix into the folder named "input".
    rIcg3NA.png


    3. Run "mokee.bat" and let the magic happen! :D
    fuPbJkk.png
    J3SMUKV.png


    4. If successful, the fixed APKs will be in the "output" folder, now named "done-[original name].apk".
    vqUT6mG.png

    Linux Tutorial:
    1. Download mokee-theme-fixer_[version number]-linux.zip and extract the folder named "mokee" in it.

    2. Open the "mokee" folder and you will see a few more folders. Place the APKs you want to fix into the folder named "input".

    3. Execute "mokee.sh" and let the magic happen! (Remember to cd to that directory if using Terminal) :D

    4. If successful, the fixed APKs will be in the "output" folder, now named "done-[original name].apk".​

    Note:
    1. The Windows version was developed and tested in Windows 8.1.
    2. The Linux version was developed and tested in Ubuntu 12.04 LTS.
    3. If you cannot execute the Linux version, please chmod 755 mokee/mokee.sh and mokee/tools/aapt.​

    Credits:

    Changelog:
    Code:
    [U]v1:[/U]
    - Initial release
    
    [U]v2:[/U]
    - Fixed aapt not accepting uppercase letters and reduced size with strip and UPX
    - Reduced size of Windows executables with strip and UPX

    5
    Got following error when try to convert hue theme, any idea?
    Code:
    --------------------------------------
    MoKee OpenSource Theme Fixer v1
    Copyright 2012-2014
    --------------------------------------
    
    --> Processing HueWhiteKat_4.4.apk... <--
    I: Using Apktool 2.0.0-Beta8 on HueWhiteKat_4.4.apk
    I: Loading resource table...
    I: Loading resource table...
    I: Decoding AndroidManifest.xml with resources...
    I: Loading resource table from file: framework\1.apk
    I: Regular manifest package...
    I: Decoding file-resources...
    I: Decoding values */* XMLs...
    I: Baksmaling...
    I: Copying assets and libs...
    I: Copying unknown files/dir...
    I: Copying original files...
    I: Using Apktool 2.0.0-Beta8 on HueWhiteKat_4.4.apk
    I: Checking whether sources has changed...
    I: Smaling...
    I: Checking whether resources has changed...
    I: Building resources...
    res\xml\com_alensw_PicFolder.xml: Invalid file name: must contain only [a-z0-9_.
    ]
    res\xml\com_alensw_PicFolder.xml: Invalid file name: must contain only [a-z0-9_.
    ]
    res\xml\com_keramidas_TitaniumBackup.xml: Invalid file name: must contain only [
    a-z0-9_.]
    res\xml\com_keramidas_TitaniumBackup.xml: Invalid file name: must contain only [
    a-z0-9_.]
    res\xml\com_quoord_tapatalkHD.xml: Invalid file name: must contain only [a-z0-9_
    .]
    res\xml\com_quoord_tapatalkHD.xml: Invalid file name: must contain only [a-z0-9_
    .]
    res\xml\vStudio_Android_Camera360.xml: Invalid file name: must contain only [a-z
    0-9_.]
    res\xml\vStudio_Android_Camera360.xml: Invalid file name: must contain only [a-z
    0-9_.]
    res\xml\vStudio_Android_Camera360.xml: Invalid file name: must contain only [a-z
    0-9_.]
    Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.Androl
    ibException: brut.common.BrutException: could not exec command: [tools\aapt.exe,
     p, --min-sdk-version, 16, --target-sdk-version, 16, --version-code, 31, --versi
    on-name, 4.4, -F, C:\Users\XX\AppData\Local\Temp\APKTOOL4753921697499202546.tmp
    , -x, 10, -I, framework\1.apk, -S, C:\mokeeThemeFixerv1\tmp\HueWhiteKat_4.4.apk\
    res, -M, C:\mokeeThemeFixerv1\tmp\HueWhiteKat_4.4.apk\AndroidManifest.xml]
            at brut.androlib.Androlib.buildResourcesFull(Androlib.java:434)
            at brut.androlib.Androlib.buildResources(Androlib.java:362)
            at brut.androlib.Androlib.build(Androlib.java:285)
            at brut.androlib.Androlib.build(Androlib.java:258)
            at brut.apktool.Main.cmdBuild(Main.java:236)
            at brut.apktool.Main.main(Main.java:88)
    Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could not
     exec command: [tools\aapt.exe, p, --min-sdk-version, 16, --target-sdk-version,
    16, --version-code, 31, --version-name, 4.4, -F, C:\Users\XX\AppData\Local\Temp
    \APKTOOL4753921697499202546.tmp, -x, 10, -I, framework\1.apk, -S, C:\mokeeThemeF
    ixerv1\tmp\HueWhiteKat_4.4.apk\res, -M, C:\mokeeThemeFixerv1\tmp\HueWhiteKat_4.4
    .apk\AndroidManifest.xml]
            at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav
    a:470)
            at brut.androlib.Androlib.buildResourcesFull(Androlib.java:415)
            ... 5 more
    Caused by: brut.common.BrutException: could not exec command: [tools\aapt.exe, p
    , --min-sdk-version, 16, --target-sdk-version, 16, --version-code, 31, --version
    -name, 4.4, -F, C:\Users\XX\AppData\Local\Temp\APKTOOL4753921697499202546.tmp,
    -x, 10, -I, framework\1.apk, -S, C:\mokeeThemeFixerv1\tmp\HueWhiteKat_4.4.apk\re
    s, -M, C:\mokeeThemeFixerv1\tmp\HueWhiteKat_4.4.apk\AndroidManifest.xml]
            at brut.util.OS.exec(OS.java:89)
            at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav
    a:464)
            ... 6 more
    
    Done if no errors above!
    Press enter to exit...
    Terminate batch job (Y/N)?

    Owh, that's caused by having capital letters in the package name...have to patch aapt for that but haven't found out how...:(
    3
    Good news guys, versions after 14/4/2014 will finally have theme engine fixed! No more converting needed! Wohoo! :D
    2
    Got following error when try to convert hue theme, any idea?

    Fixed aapt and usable now...;)

    tBC2aIC.png


    So with that, v2 is released! Changelogs and links in first post! :D
    1
    thank you for your hard work

    a bit off topic but what do you all think some of the best themes are

    OK, so am on the 20140414 build and themes are working without conversion...will get this thread closed...:)