I'm not a developer, but i want to edit some .xml inside .apk files just for my own use.
I'm trying to recompile CM7 based apps for our mini pro, but becouse they are custom apps, it give me lot of png erros. And when its done, the apk don't have resources.arsc inside, too.
I don't know what i'm doing wrong and any help will be very appreciated!
p.s.: I'm using apkmanager 4.9, the apk is Contacts.apk and the rom is MiniCM7 Pro - V7x by paul-xxx.
Introduction
Here I am releasing the kitchen and a lengthy guide on what makes it special, how it works, et cetera; as my goodbye gift to the X10 forum as I want to keep this knowledge open so others might be able to help. Please be aware that this is not for newbies, I hope that other people still building custom ROM's for X10 will put my research to good use. It is directly (but heavily modified and enhanced) based on the script by erenz1202 and probably has additional credits, I don't know. His original thread is here for your reference.
I hope to keep this kitchen/guide a progressive effort, I will do my best to keep this thread maintained with the help of all contributors. If you have any questions, don't hesitate to ask! But if you're a newbie and don't know anything about development, please don't spam the thread with silly questions... I don't have the time to teach someone how to use a computer
This thread is under construction, I did rush writing it. Please post your suggestions for sections/updates/anything in this thread. I would love to see a good "Team-XDA" effort
If any other MIUI ROM builders want to take my sh!t and use it in their ROM, I really don't care so go for it. LOL. Credit would be nice but I wouldn't be surprised if you don't. But I really hope this doesn't cause a bunch of people to release ROM's based on this MIUI with no real GOOD changes without sharing the knowledge here, the X10 Dev forum is already enough of a popularity-contest
Notable Features
- Automatic APK/JAR injection subroutines (see below for details)
- Full logging of the build script/process
- Unique tweaks/hacks not present in any other MIUI ROM, fully documented and explained (see below for details)
Requirements
- Windows Vista/7 required (Windows XP cannot handle this advanced batch file)
- Java Runtime Environment
- Above-average knowledge of batch files, XML, smali
Downloads
You can find all relevant downloads, including old versions of CosmicUI, in my Mediafire folder - the important stuff is in the 'Kitchen' subfolder.
http://www.mediafire.com/?ksvtupinjw8nd
- Kitchen update for v0.6.x is also added. You still need to original kitchen, download the update ZIP and extract it to your kitchen folder (overwrite all) to update it. The new version brings a pre-build script to inject language files, and also a post-build script to PNG Optimize/zipalign/recompress JAR's and APK's.
Also included as a separate download is a self-extracting EXE of MIUI 2.4.20 for Incredible S (from MIUI UK i.e. miuiandroid.com), which Cosmic UI was based on. FXP-CM7 is not included, you will need download that from the OT too.
Instruction/Guide
Unpack the kitchen.zip archive to a new folder on your Windows Vista/7 PC. Doesn't matter where, just as long as you have full administration rights (and run the batch file as administrator if you have UAC enabled). Here is an explanation of the kitchen contents:
base_cm7source
- Extract FXP-CM7 files here. CosmicUI v0.5 uses FXP-124. Use the /system contents of the flashable ZIP, not the system subfolder (i.e. this is valid - .\base_cm7source\build.prop)
base_miui
- Extract MIUI files here. Note that this folder is modified with every build, I have created a self-extracting EXE of MIUI 2.4.20 for Incredible S from miuiandroid.com and uploaded it to the mediafire folder. Place this in the root kitchen folder and run it if you need to unpack again, it will extract to the base_miui folder. Open the EXE with WinRAR (or 7-Zip) if you want to inspect it. If you want an original ZIP of MIUI 2.4.20 for various devices, check the page here for direct downloads.
base_postmods
- Precompiled stuff for the MIUI build, either replacing original MIUI/FXP files or completely new. Some is unique to CosmicUI, details in next section.
base_postmods_inject
- Source files for automated JAR/APK injection functions, with a specific folder structure and details of each modification included. Details in next section.
base_postmods_inject_obsolete
- As above, but these are no longer used (and excluded from the build script). They were either for older versions of CosmicUI or only ever used in my test builds.
base_postmods_special
- Special injections for use with my automated mods/scripts in CosmicUI, currently used for building Extended Settings APK/JAR and HW-LED fixed framework APK. The build script will show that these injections are not automated like the base_postmods_inject folder.
base_tool
- All the dependencies and tools used for the build script. Includes 7z binary, aapt, apktool and package-signing jar's. Note that I use APKTool for jar files instead of smali/baksmali, because APK tool has some fixes that the original (bak)smali doesn't. So if you manually decompile APK's/JAR's, you will need to use Apktool v1.4.3 to keep smali/xml compatibility with the mods in this kitchen (you will get compile errors if you mix decompiled files from different versions). This folder also contains a custom 'usr' folder from the original kitchen, I never updated it and it is still used by the build script.
CosmicUI Modpack (obsolete since 0.4)
- Just an extracted Flashable-ZIP of the old Modpack for 0.3 (pre-Aroma). Don't use it on new versions
CosmicUI-FixPermissions
- Just an extracted Flashable-ZIP of a little updater-script that fixes all permissions on /system partition, useful when pushing new files via adb in CWR without having to chmod/chown. I originally made it to save time but it's a bit redundant if you use my modified kCernel-v01 since it boots directly to TouchRecovery (which has Fix Permissions in the menu).
CosmicUI-kernel-kCernel_v01
- Just an extracted Flashable-ZIP of my modified kCernel v01. Only differences are (a) the boot graphic and (b) Boot Menu removed and only uses Touch Recovery (saves time).
CosmicUI-v0.4.01.122
CosmicUI-v0.5.01.124
- Templates for CWM-flashable ZIP after building. Move the system folder into this folder, ZIP the contents and flash. Includes all the Aroma install stuff.
~build.bat
- The main magic. This batch file is well commented and has a lot of experimental stuff commented-out. Take a look. If it makes no sense to you at all, you're not experienced enough to use a kitchen! But feel free to ask specific questions about it
~build.txt
- This is the log file (new one created every time) when running the above script. Good for checking errors with the build, especially with APK Tool (de)compiling or missing files. Pretty fancy stuff there!
How to do a quick build to make CosmicUI v0.5.x?
1) Extract contents of FXP-124 .\system\ to base_cm7source
2) Extract MIUIandroid.com's 2.4.20 for Incredible S contents of .\system\ to base_miui
3) Run the ~build.bat file (yes, it takes a while - the JAR/APK injection mainly)
4) Move the new created .\system\ folder to the flashable-CWM ZIP template folder (e.g., .\CosmicUI-v0.5.01.124\)
5) ZIP up the contents of the template folder you used above, and install the update in CWR.
About base_postmods_inject
Inside the folder you will see two others, app and framework - this is pretty self explanatory. If we go inside framework for example, we will see three folders and three files:
framework.jar [folder]
framework-res.apk [folder]
services.jar [folder]
framework.txt
framework-res.txt
services.txt
Let's take a look at framework.jar. The txt file for it just explains what is in there, it's not used in the build script but is for your info. In this case, it details the changed files used for patching-in some WebKit and Net code to eliminate the need for the 2048 read_ahead_kb tweak that most other MIUI ROM's for X10 need to prevent the WLOD's. Anyway, inside the folder is a smali folder - it follows the same directory tree of the original decompiled package (remember - with apktool 1.4.3), but with only the changes necessary for the patch. [FYI, The 'build' folder is re-created with every build, designed to be a cached-compile to speed the build process but it doesnt work right - probably because of changed timestamps. Don't worry about it.]
Anyway, you could use a program like WinMerge to examine the differences of the changed files and find the patches I made. In the case of framework.jar there is a problem with battery drain in the \net\ code (I think), it's a fairly dirty hack that might put the system_server in a constant loop. I don't know. Anyway, that's everything explained about the apk/jar injection feature. I think. If you want to mod another .apk or .jar, remember to compare your changes to the original and then - following the directory tree of existing injection mods as a template - make new folders and move the modified files there.
UNDER CONSTRUCTION, NOT FINISHED. Ideas/suggestions welcome! Peace
This seems awesome!!!! thanks alot!!
wow, this is beyond generous....thank you very much.
Sent from my Desire HD using xda premium
Tnkz a LOT!!!!!!
I'll still be working on this, I'm not getting rid of my X10 yet. Current priorities:
(1) Get latest MIUI Camera working
(2) Fix battery drain when data enabled
(3) Make it multilanguage
(4) What else? Ideas welcome.
I am also considering downgrading the MIUI version. The current 2.4.20 was never "stable", it was a development release from Xaomi. MIUI 2.3.7 was the last "stable" MIUI Gingerbread release. I don't know the difference between 2.3.7 and 2.4.20 though, does anyone know?
Dan if you update the rom so update miui version not get back to 2.3.7 ( just kidding )
while im looking on miuis thread i'v seen 2.5.11 ( camera updated )
and 2.5.25 i think its more stable than the 2.6.8 version ( that what i see )
so why not to update to a new miui ??
sparxx4 said:
Dan if you update the rom so update miui version not get back to 2.3.7 ( just kidding )
while im looking on miuis thread i'v seen 2.5.11 ( camera updated )
and 2.5.25 i think its more stable than the 2.6.8 version ( that what i see )
so why not to update to a new miui ??
Click to expand...
Click to collapse
Sorry, don't know how I missed this reply lol. Well MIUI 2.3.7 is the last stable gingerbread release of MIUI. 2.4.20 was only ever a development release. So I think there may be some bugs in 2.4.20 (but I can't find anything).
MIUI 2.5 and onwards are only for ICS sadly. I do plan to work on MIUI for ICS in some time, but there are already a heap of X10 MIUI ROM's for ICS and MIUI4 is still beta and many things will change.
Looking at the official MIUI download page, they say Latest Version is 2.6.1. But the latest Gingerbread release is 2.3.7c (e.g. for Desire).
And then in the development downloads, the last one listed for Gingerbread is only 2.4.13.
I have dug around for newer MIUI versions for Gingerbread, I am 99% sure that 2.4.20 is the last one. The best I can do is work on porting over some of the newer apps from MiCode project Gingerbread-branch (open-source MIUI repo) because those apps might have some new updates and fixes.
v0.6 kitchen update added to the folder.
- Kitchen update for v0.6.x is also added. You still need to original kitchen, download the update ZIP and extract it to your kitchen folder (overwrite all) to update it. The new version brings a pre-build script to inject language files, and also a post-build script to PNG Optimize/zipalign/recompress JAR's and APK's.
Click to expand...
Click to collapse
i dont know what im doing ,,,but im trying
Dan on your kitchen you use Incredible s miui rom
but erenz use nexus 1 miui rom
so what the different ?
Any screenshot?? Interesting
Sent from my X10i using xda premium
Superman said:
Any screenshot?? Interesting
Sent from my X10i using xda premium
Click to expand...
Click to collapse
screenshot for what my friend ??
---------- Post added at 02:43 PM ---------- Previous post was at 02:41 PM ----------
i think i found it why you use the incredible s miui not the nexus 1
simple i think bcuz it have the latest stable GB miui wich 2.4.2 and nexus 1 have the 2.3.3
how smart i am
right ?
sparxx4 said:
screenshot for what my friend ??
---------- Post added at 02:43 PM ---------- Previous post was at 02:41 PM ----------
i think i found it why you use the incredible s miui not the nexus 1
simple i think bcuz it have the latest stable GB miui wich 2.4.2 and nexus 1 have the 2.3.3
how smart i am
right ?
Click to expand...
Click to collapse
2.4.2 was not a stable MIUI it was the last development release on GB branch.
Is there xloud for miui ?? Its realy low
Sent from my X10i using XDA
hey Dan can i build v 7 with this steps only ??
How to do a quick build to make CosmicUI v0.5.x?
1) Extract contents of FXP-124 .\system\ to base_cm7source
2) Extract MIUIandroid.com's 2.4.20 for Incredible S contents of .\system\ to base_miui
3) Run the ~build.bat file (yes, it takes a while - the JAR/APK injection mainly)
4) Move the new created .\system\ folder to the flashable-CWM ZIP template folder (e.g., .\CosmicUI-v0.5.01.124\)
5) ZIP up the contents of the template folder you used above, and install the update in CWR.
or there is another thing i have to do ??
That's pretty much it yes, as long as you don't want multilanguage and stuff. There is another batch file for multilanguage injection in the kitchen update. Examine the batch files for details and usage.
But what exactly would make that v7? It'll be the same as 0.6.
i just name it v7
but whats im going to do just updating CM source for the last .. i just want to get into making a rom world
a small step for me but it give me alot and i will be happy if you help me
and pleas talk to me simple english i dont understand all the dev words
---------- Post added at 10:19 AM ---------- Previous post was at 10:14 AM ----------
so here what i'v do for now
taking miui base from the incredible s
taking fxpCm7.2 130 base
puting it on the folders ,, run Build
im cool for now ??
Well... If you don't understand all the dev words you might have a hard time working with the kitchen Yeah cool, you could try building with FXP129 or whatever the latest CM7 is for X10.
What the ROM really needs in an experienced smali and script editor.
CosmicDan said:
Well... If you don't understand all the dev words you might have a hard time working with the kitchen Yeah cool, you could try building with FXP129 or whatever the latest CM7 is for X10.
What the ROM really needs in an experienced smali and script editor.
Click to expand...
Click to collapse
yeah im sure you too had a hard time on the beginning
i will try google what i dont understand and ask you for sure
so after build done ,, i just take the System folder add it to a flashble folder and zip it ???
sparxx4 said:
yeah im sure you too had a hard time on the beginning
i will try google what i dont understand and ask you for sure
so after build done ,, i just take the System folder add it to a flashble folder and zip it ???
Click to expand...
Click to collapse
Yes.
then im cool for now .. build done and the zip done ... all is need now testing the rom
Hi All,
I need to get APK from AOSP (a 4.2.2 Browser in particular), I have an Android SDK with synced 4.2 branch. Is there a way to extract just one APK or do I need to make a ROM?
Thanks in advance!
yes u can do so...
Summer Son said:
Hi All,
I need to get APK from AOSP (a 4.2.2 Browser in particular), I have an Android SDK with synced 4.2 branch. Is there a way to extract just one APK or do I need to make a ROM?
Thanks in advance!
Click to expand...
Click to collapse
u can extract apk code but if u try to build through ecllipse then it wont compile because of missing libraries that are only available in full source...
just look in Android.mk
and try to satisfy the needed libraries...
Hi to all!
I am new in the Android world and I have a mutimidia car system with Android 2.3.4.
The problem i have is to install new applications available on the playstore like Viago.
This application requires at least Android. I have the Android 2.3.4 ROM soucecode and my doubt is if can i make a compilation of the ROM, to upgrada to Android 4 just modifying the sourcecode of the ROM i have.
Or if can i use any other V4 stock ROM, and add the kernel i have and cook it together.
Thanks in advance.
c_verri said:
Hi to all!
I am new in the Android world and I have a mutimidia car system with Android 2.3.4.
The problem i have is to install new applications available on the playstore like Viago.
This application requires at least Android. I have the Android 2.3.4 ROM soucecode and my doubt is if can i make a compilation of the ROM, to upgrada to Android 4 just modifying the sourcecode of the ROM i have.
Or if can i use any other V4 stock ROM, and add the kernel i have and cook it together.
Thanks in advance.
Click to expand...
Click to collapse
Well, what you could do is modify the AndroidManifest.xml in the apk file so that the minSdkVersion is set to API 10. so it would look like this:
minSdkVersion="resource_id:0x10"
Make sure that the app does not require any features that are not in Gingerbread. I hope this helps.
rcunningham said:
Well, what you could do is modify the AndroidManifest.xml in the apk file so that the minSdkVersion is set to API 10. so it would look like this:
minSdkVersion="resource_id:0x10"
Make sure that the app does not require any features that are not in Gingerbread. I hope this helps.
Click to expand...
Click to collapse
Thanks for your quick response. I have some trouble. When I decompile the apk, i am having some errors and dont know what to do. The apk is fully functional in my s4 mini With Android 4.2. this apk (garmin viago) and apktool are not good friends. Initially there are some errors with .9.png images, i've made the Changes in the AndroidManifest.xml and then a recompiled the apk. The result: More and more errors. The only i want to do is modify the min sdk to 10. I Dont know where to follow.
c_verri said:
Thanks for your quick response. I have some trouble. When I decompile the apk, i am having some errors and dont know what to do. The apk is fully functional in my s4 mini With Android 4.2. this apk (garmin viago) and apktool are not good friends. Initially there are some errors with .9.png images, i've made the Changes in the AndroidManifest.xml and then a recompiled the apk. The result: More and more errors. The only i want to do is modify the min sdk to 10. I Dont know where to follow.
Click to expand...
Click to collapse
Trying to get a apk file from Android 4.2 to work on Gingerbread is hard. Getting a apk from ICS to work on Gingerbread is much more simple. But if you only make changes to the AndroidManifest.xml everything should work. If you have more issues, message me on XDA and I could help you a bit more. I might get marked as spam if I post on this page to much.