Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Thread Closed

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

OP Ryuinferno

20th December 2013, 08:16 AM   |  #1  
Ryuinferno's Avatar
OP Recognized Contributor
Thanks Meter: 6,844
 
3,486 posts
Join Date:Joined: Apr 2012
Donate to Me
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!!!
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-th...meEngineDesign

The main point is at:
Quote:

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.


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. Run "mokee.bat" and let the magic happen!


4. If successful, the fixed APKs will be in the "output" folder, now named "done-[original name].apk".
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)

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:
v1:
- Initial release

v2:
- Fixed aapt not accepting uppercase letters and reduced size with strip and UPX
- Reduced size of Windows executables with strip and UPX
Downloads:
mokee-theme-fixer_v2 (Windows & Linux)
Last edited by Ryuinferno; 7th January 2014 at 01:43 PM.
The Following 34 Users Say Thank You to Ryuinferno For This Useful Post: [ View ]
1st January 2014, 03:08 AM   |  #2  
Senior Member
Thanks Meter: 457
 
707 posts
Join Date:Joined: Nov 2012
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)?
1st January 2014, 03:32 AM   |  #3  
Ryuinferno's Avatar
OP Recognized Contributor
Thanks Meter: 6,844
 
3,486 posts
Join Date:Joined: Apr 2012
Donate to Me
Quote:
Originally Posted by antutu

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...
The Following 5 Users Say Thank You to Ryuinferno For This Useful Post: [ View ]
6th January 2014, 05:43 PM   |  #4  
Fast-Droid's Avatar
Senior Member
Manhattan
Thanks Meter: 150
 
195 posts
Join Date:Joined: Feb 2011
Worked for (Holo Glass Beta) theme on my Maguro..Thanks!!
Attached Thumbnails
Click image for larger version

Name:	Screenshot_2014-01-06-11-21-20.jpg
Views:	2202
Size:	61.0 KB
ID:	2498393   Click image for larger version

Name:	Screenshot_2014-01-06-11-22-40.jpg
Views:	2088
Size:	90.9 KB
ID:	2498394  
Last edited by Fast-Droid; 6th January 2014 at 06:22 PM.
The Following User Says Thank You to Fast-Droid For This Useful Post: [ View ]
7th January 2014, 01:44 PM   |  #5  
Ryuinferno's Avatar
OP Recognized Contributor
Thanks Meter: 6,844
 
3,486 posts
Join Date:Joined: Apr 2012
Donate to Me
Quote:
Originally Posted by antutu

Got following error when try to convert hue theme, any idea?

Fixed aapt and usable now...



So with that, v2 is released! Changelogs and links in first post!
The Following 2 Users Say Thank You to Ryuinferno For This Useful Post: [ View ]
7th January 2014, 02:42 PM   |  #6  
Senior Member
Thanks Meter: 457
 
707 posts
Join Date:Joined: Nov 2012
yes it's working
you just made my day
21st January 2014, 03:59 AM   |  #7  
thuva06's Avatar
Senior Member
Thanks Meter: 29
 
144 posts
Join Date:Joined: Nov 2013
More
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
21st January 2014, 04:03 AM   |  #8  
Ryuinferno's Avatar
OP Recognized Contributor
Thanks Meter: 6,844
 
3,486 posts
Join Date:Joined: Apr 2012
Donate to Me
*Facepalm*...you are supposed to convert the theme apk you want and install as normal...not Themechooser.apk... don't touch that at all...and don't cross post please...
The Following User Says Thank You to Ryuinferno For This Useful Post: [ View ]
17th February 2014, 05:22 PM   |  #9  
lolo696's Avatar
Member
Flag minsk
Thanks Meter: 16
 
84 posts
Join Date:Joined: Sep 2013
More
I have here is off
Attached Thumbnails
Click image for larger version

Name:	??????????.jpg
Views:	664
Size:	147.9 KB
ID:	2584843  
20th February 2014, 11:14 AM   |  #10  
Primokorn's Avatar
Recognized Contributor
Thanks Meter: 2,802
 
4,968 posts
Join Date:Joined: Nov 2012
Donate to Me
More
I have several errors during the extracting process of mokee-theme-fixer_v2-windows.zip. I have Win7 64bits.

Thread Closed Subscribe to Thread

Tags
fix, mokee, rom, theme
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes