[SOLVED]Problem with compiling framework-miui-res.apk[SOLVED]


sijav

Members
Mar 12, 2013
12
15
Hey guys,
I'm having a funny problem in compiling miui framework with apktool,
here it is:
Code:
apktool b out/framework-miui-res out/framework-miui-res.apk
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
invalid resource directory name: /home/sijav/Desktop/patchrom/nypone/out/framework-miui-res/res/drawable-largeui-hdpi
invalid resource directory name: /home/sijav/Desktop/patchrom/nypone/out/framework-miui-res/res/values-largeui-xhdpi
invalid resource directory name: /home/sijav/Desktop/patchrom/nypone/out/framework-miui-res/res/drawable-largeui-xhdpi
invalid resource directory name: /home/sijav/Desktop/patchrom/nypone/out/framework-miui-res/res/values-largeui-hdpi
Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, -F, /tmp/APKTOOL8916500702804855339.tmp, -x, -I, /home/sijav/apktool/framework/1.apk, -I, /home/sijav/apktool/framework/2.apk, -I, /home/sijav/apktool/framework/3.apk, -I, /home/sijav/apktool/framework/4.apk, -I, /home/sijav/apktool/framework/5.apk, -S, /home/sijav/Desktop/patchrom/nypone/out/framework-miui-res/res, -M, /home/sijav/Desktop/patchrom/nypone/out/framework-miui-res/AndroidManifest.xml]
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:193)
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:301)
at brut.androlib.Androlib.buildResources(Androlib.java:248)
at brut.androlib.Androlib.build(Androlib.java:171)
at brut.androlib.Androlib.build(Androlib.java:154)
at brut.apktool.Main.cmdBuild(Main.java:182)
at brut.apktool.Main.main(Main.java:67)
Caused by: brut.common.BrutException: could not exec command: [aapt, p, -F, /tmp/APKTOOL8916500702804855339.tmp, -x, -I, /home/sijav/apktool/framework/1.apk, -I, /home/sijav/apktool/framework/2.apk, -I, /home/sijav/apktool/framework/3.apk, -I, /home/sijav/apktool/framework/4.apk, -I, /home/sijav/apktool/framework/5.apk, -S, /home/sijav/Desktop/patchrom/nypone/out/framework-miui-res/res, -M, /home/sijav/Desktop/patchrom/nypone/out/framework-miui-res/AndroidManifest.xml]
at brut.util.OS.exec(OS.java:83)
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:191)
... 6 more

Have any Idea? Please share it :D
Thanks in advance
 

sijav

Members
Mar 12, 2013
12
15
Thnx but I already try that I have even tryed your diff =>
Code:
diff --git a/tools/aapt/AaptAssets.cpp b/tools/aapt/AaptAssets.cpp
index 3d6537a..e4c069c 100644
--- a/tools/aapt/AaptAssets.cpp
+++ b/tools/aapt/AaptAssets.cpp
@@ -1019,6 +1019,18 @@ bool AaptGroupEntry::getUiModeTypeName(const char* name,
              (out->uiMode&~ResTable_config::MASK_UI_MODE_TYPE)
              | ResTable_config::UI_MODE_TYPE_TELEVISION;
        return true;
+    } else if (strcmp(name, "smallui") == 0) {
+        if (out) out->uiMode = (out->uiMode&~ResTable_config::MASK_UI_MODE_TYPE) | 0x0c;
+        return true;
+    } else if (strcmp(name, "mediumui") == 0) {
+        if (out) out->uiMode = (out->uiMode&~ResTable_config::MASK_UI_MODE_TYPE) | 0x0d;
+        return true;
+    } else if (strcmp(name, "largeui") == 0) {
+        if (out) out->uiMode = (out->uiMode&~ResTable_config::MASK_UI_MODE_TYPE) | 0x0e;
+        return true;
+    } else if (strcmp(name, "hugeui") == 0) {
+        if (out) out->uiMode = (out->uiMode&~ResTable_config::MASK_UI_MODE_TYPE) | 0x0f;
+        return true;
    }
 
    return false;
but seems my ubuntu diff doesn't undrestand diff --git (give error that this command is unknown!)
any other help would be appreciate :)

EDIT:
one more thing if I use google's latest apktool.jar I encounter this error => java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean
 

Acid

Scripting Ninja
Staff member
Aug 20, 2011
2,728
247
Do this:
type apktool in terminal and confirm here that you have 1.5.3. Also download MIUI appt again from the link iBotPeaches wrote and in ubuntu put aapt into /usr/local/bin.
Like this:
Code:
sudo cp aapt /usr/local/bin
sudo chmod a+x /usr/local/bin/aapt

If you don't have apktool in system PATH then go to your tools folder where you have apktool.jar and type:
Code:
java -jar apktool.jar --version
 
  • Like
Reactions: sijav

sijav

Members
Mar 12, 2013
12
15
Well my problems solved by changing from ubuntu 32bit to 64bit ;)
I had that apktool and all and I had Installed anykind of apktool
any thnx for all of your replays :)
 
Jul 5, 2013
10
11
Hey guys,
I'm having a funny problem in compiling miui framework with apktool,
here it is:
Code:
apktool b out/framework-miui-res out/framework-miui-res.apk
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
invalid resource directory name: /home/sijav/Desktop/patchrom/nypone/out/framework-miui-res/res/drawable-largeui-hdpi
invalid resource directory name: /home/sijav/Desktop/patchrom/nypone/out/framework-miui-res/res/values-largeui-xhdpi
invalid resource directory name: /home/sijav/Desktop/patchrom/nypone/out/framework-miui-res/res/drawable-largeui-xhdpi
invalid resource directory name: /home/sijav/Desktop/patchrom/nypone/out/framework-miui-res/res/values-largeui-hdpi
Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, -F, /tmp/APKTOOL8916500702804855339.tmp, -x, -I, /home/sijav/apktool/framework/1.apk, -I, /home/sijav/apktool/framework/2.apk, -I, /home/sijav/apktool/framework/3.apk, -I, /home/sijav/apktool/framework/4.apk, -I, /home/sijav/apktool/framework/5.apk, -S, /home/sijav/Desktop/patchrom/nypone/out/framework-miui-res/res, -M, /home/sijav/Desktop/patchrom/nypone/out/framework-miui-res/AndroidManifest.xml]
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:193)
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:301)
at brut.androlib.Androlib.buildResources(Androlib.java:248)
at brut.androlib.Androlib.build(Androlib.java:171)
at brut.androlib.Androlib.build(Androlib.java:154)
at brut.apktool.Main.cmdBuild(Main.java:182)
at brut.apktool.Main.main(Main.java:67)
Caused by: brut.common.BrutException: could not exec command: [aapt, p, -F, /tmp/APKTOOL8916500702804855339.tmp, -x, -I, /home/sijav/apktool/framework/1.apk, -I, /home/sijav/apktool/framework/2.apk, -I, /home/sijav/apktool/framework/3.apk, -I, /home/sijav/apktool/framework/4.apk, -I, /home/sijav/apktool/framework/5.apk, -S, /home/sijav/Desktop/patchrom/nypone/out/framework-miui-res/res, -M, /home/sijav/Desktop/patchrom/nypone/out/framework-miui-res/AndroidManifest.xml]
at brut.util.OS.exec(OS.java:83)
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:191)
... 6 more

Have any Idea? Please share it :D
Thanks in advance
How did you fixed this error?? And error after this???
 
Jul 5, 2013
10
11
Those errors are answered above this post.
Code:
brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, -F, /tmp/APKTOOL7414635234658980451.tmp, -x, -S, /home/aditya/patchrom/stock/out/framework-res/res, -M, /home/aditya/patchrom/stock/out/framework-res/AndroidManifest.xml]
    at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:193)
    at brut.androlib.Androlib.buildResourcesFull(Androlib.java:301)
    at brut.androlib.Androlib.buildResources(Androlib.java:248)
    at brut.androlib.Androlib.build(Androlib.java:171)
    at brut.androlib.Androlib.build(Androlib.java:154)
    at brut.apktool.Main.cmdBuild(Main.java:182)
    at brut.apktool.Main.main(Main.java:67)
Caused by: brut.common.BrutException: could not exec command: [aapt, p, -F, /tmp/APKTOOL7414635234658980451.tmp, -x, -S, /home/aditya/patchrom/stock/out/framework-res/res, -M, /home/aditya/patchrom/stock/out/framework-res/AndroidManifest.xml]
    at brut.util.OS.exec(OS.java:83)
    at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:191)
    ... 6 more
make: *** [out/framework-res.apk] Error 1
I used aapt provided by you still getting this error any suggestions??
 

iBotPeaches

Script Gatekeeper
Oct 31, 2011
3,808
335
Code:
brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, -F, /tmp/APKTOOL7414635234658980451.tmp, -x, -S, /home/aditya/patchrom/stock/out/framework-res/res, -M, 
make: *** [out/framework-res.apk] Error 1
I used aapt provided by you still getting this error any suggestions??


Patchrom uses Apktool 1.4.3. 1.5.2 is out, 2.0.0 is in internal beta. Maybe try the newest stuff.
 
Jul 5, 2013
10
11
Patchrom uses Apktool 1.4.3. 1.5.2 is out, 2.0.0 is in internal beta. Maybe try the newest stuff.
Sir im facing this problem! What solution you suggest me??
Code:
Sign target files
Traceback (most recent call last):
  File "../tools/releasetools/sign_target_files_apks", line 82, in <module>
    import common
  File "/home/aditya/patchrom/tools/releasetools/common.py", line 42, in <module>
    OPTIONS.search_path = os.path.join(os.environ["PORT_ROOT"], "tools");
  File "/usr/lib/python2.7/UserDict.py", line 23, in __getitem__
    raise KeyError(key)
KeyError: 'PORT_ROOT'
mv: cannot stat `temp.zip': No such file or directory
Build full ota package: /home/aditya/patchrom/baffin/out/fullota.zip
Traceback (most recent call last):
  File "../tools/releasetools/ota_from_target_files", line 76, in <module>
    import common
  File "/home/aditya/patchrom/tools/releasetools/common.py", line 42, in <module>
    OPTIONS.search_path = os.path.join(os.environ["PORT_ROOT"], "tools");
  File "/usr/lib/python2.7/UserDict.py", line 23, in __getitem__
    raise KeyError(key)
KeyError: 'PORT_ROOT'
make: *** [fullota] Error 1
aditya@aditya-Inspiron-5520:~/patchrom/baffin$
 

iBotPeaches

Script Gatekeeper
Oct 31, 2011
3,808
335
Sir im facing this problem! What solution you suggest me??
Code:
Sign target files
Traceback (most recent call last):
  File "../tools/releasetools/sign_target_files_apks", line 82, in <module>
    import common
  File "/home/aditya/patchrom/tools/releasetools/common.py", line 42, in <module>
    OPTIONS.search_path = os.path.join(os.environ["PORT_ROOT"], "tools");
  File "/usr/lib/python2.7/UserDict.py", line 23, in __getitem__
    raise KeyError(key)
KeyError: 'PORT_ROOT'
mv: cannot stat `temp.zip': No such file or directory
Build full ota package: /home/aditya/patchrom/baffin/out/fullota.zip
Traceback (most recent call last):
  File "../tools/releasetools/ota_from_target_files", line 76, in <module>
    import common
  File "/home/aditya/patchrom/tools/releasetools/common.py", line 42, in <module>
    OPTIONS.search_path = os.path.join(os.environ["PORT_ROOT"], "tools");
  File "/usr/lib/python2.7/UserDict.py", line 23, in __getitem__
    raise KeyError(key)
KeyError: 'PORT_ROOT'
make: *** [fullota] Error 1
aditya@aditya-Inspiron-5520:~/patchrom/baffin$


That is not an apktool error. Hell if I know what python error that is.