Hi all,
I tried to theme an apk (ie. SwitchPro), after some search I got ApkTool and Android-sign (osx droplet).
So to test if it worked I decompressed it using ApkTool and recompressed, then Signed.
During apk install it just says "App not installed".
What's wrong ?
Thanks
The problem i had was that the resulting .apk seemed a lot smaller than it should after recompileing with apktool. If you are just editing images i suggest extracting the images form the .apk. Then you edit as you like. Then open the original apk with WinRAR (or whatever you use) and simply add your edited images to the .apk file. Then install and it should work.
Related
Noob to theme'ing.
Do I have to make an update zip to theme or can I modify the framework apk and just push that to /system/app?
You can just modify and push framework-res.apk to system/framework/
Sent from my ADR6300 using XDA App
Oddity said:
You can just modify and push framework-res.apk to system/framework/
Click to expand...
Click to collapse
system/framework/
sorry i've been at this computer too long lol
My replacement keeps giving me boot loops.
All I changed was: I duplicated the green lockslider and its components and renamed them to replace the other gray locksliders.
then I compressed the framework-res to a zip (using built in mac zip compression, mac user so i can't use winrar) and change zip to apk. adb push to system/framework/
any ideas what is going wrong?
cupcakera said:
My replacement keeps giving me boot loops.
All I changed was: I duplicated the green lockslider and its components and renamed them to replace the other gray locksliders.
then I compressed the framework-res to a zip (using built in mac zip compression, mac user so i can't use winrar) and change zip to apk. adb push to system/framework/
any ideas what is going wrong?
Click to expand...
Click to collapse
Have you tried installing it via a update.zip?
cupcakera said:
My replacement keeps giving me boot loops.
All I changed was: I duplicated the green lockslider and its components and renamed them to replace the other gray locksliders.
then I compressed the framework-res to a zip (using built in mac zip compression, mac user so i can't use winrar) and change zip to apk. adb push to system/framework/
any ideas what is going wrong?
Click to expand...
Click to collapse
Well this gets to be a bit confusing. I will say what i know hopefully others can help out too.
APKs are just zip containers that are signed, that means there is no compression. In your zip program look for a setting under compression labeled store. You would then have to sign that bad boy in order for your phone to work. You can not use the testsign certificate.
With that being said here is a guide...
Modifying?
PNG's -> open the apk up in the zip program, navigate to the res/whatever_folder_had_the_original and drop your files in.
9.PNGs and XML more complicated. You will have to decompile the apk [apktool] then modify them [look for articles on that, i cant get too indepth here]. Compile the apk. Drag the now compiled xml and 9.pngs to the respective folder open in your zip program.
Really the object is not to mess up the signing that comes with the apk. opening up the apk in a zip program, allows you to view, and replace files with not destroying the signature.
This method will not work with all applications. I have still not figured why some programs work with being signed with a testcert and others are not. I have a hunch that all userspace programs can be test signed and all system files need their own [htc?] key.
Also to note is that for some reason the phone when looking at framework-res, services.jar and others does not seem to mind the differences in CRC of the files stored in it, with what is in the manifest. I still can figure out the phones reasoning to allow this to happen on some but not all apps.
I hope this was not very confusing. I am working on video toturials of this same subject. Stay tuned!
That really helps a lot. Thanks.
I'll try that out tonight. Any recommendations for zip programs with a store feature for mac?
cupcakera said:
That really helps a lot. Thanks.
I'll try that out tonight. Any recommendations for zip programs with a store feature for mac?
Click to expand...
Click to collapse
I use BetterZip on my mac..........open the apk with Betterzip, then extract the res folder to your desktop (or wherever you want). Edit the .png files you want.......steer clear ( unless you know how) of editing the 9.png files. Delete the original res folder from the framework folder and insert the res folder you just edited. Then save the framework-res.apk and push back to where it belongs.
I like 7zip better, but this works okay, since there is no 7zip for a mac.
Betterzip worked perfectly! Thanks again.
Hi there,
I am trying to learn all this theming and have started with the basics, the notification bar icons in framework-res.apk.
I can pull it from the phone, I can decompile it but I am having a challenge putting it all back together as I changed the number of images in a specific animation and then edited the XML file regarding that, but I think there must be other references to the files as now there are less files and the error log is saying it can't find the ones I removed (both the png's and the references in the one xml file) when trying to recompile.
Is there a master XML listing all the files expected or something.
many thanks in advance
David P
Let me guess you are using apktool?
What you need to do is take a clean version of the apk you want to edit. For arguments sake let's say you are editing framework-res.apk.
Decompile using apktool and make your edits to .xml files ONLY. Once done recompile using,
apktool b -f [foldername] framework-res.apk
Now this recompiled apk will probably not work. However the xml files will be properly recompiled. So now you extract the edited .xml files, add them to a clean unedited framework-res.apk (not a de and re copmpiled one) without extracting the .apk. Just add and replace the files using WinRar or whatever.
Also add your edited images to necessary folder in the clean .apk too. So the end result is a clean framework-res.apk that you have updated with your edited .xml files and edited images. This apk should function just fine!!
Sorry if this is a big mess but it makes sense to me and it works for me.
Thanks for the suggestion. I am not quite sure what I am using, I have tried ThemePro for windows and APKManager, both of which are just scripted batch files so I would need to check what they use to extract or decompile with.
So Basically, I decompile, edit the xml (while textual) then recompile so the XML's are binary again. Then pull the BINARY XML#'s from the APK and use those with all the appropriate files and folders which I then create a new clean APK from by zipping it and renaming to .apk, correct?
David P
ephumuris said:
Let me guess you are using apktool?
What you need to do is take a clean version of the apk you want to edit. For arguments sake let's say you are editing framework-res.apk.
Decompile using apktool and make your edits to .xml files ONLY. Once done recompile using,
apktool b -f [foldername] framework-res.apk
Now this recompiled apk will probably not work. However the xml files will be properly recompiled. So now you extract the edited .xml files, add them to a clean unedited framework-res.apk (not a de and re copmpiled one) without extracting the .apk. Just add and replace the files using WinRar or whatever.
Also add your edited images to necessary folder in the clean .apk too. So the end result is a clean framework-res.apk that you have updated with your edited .xml files and edited images. This apk should function just fine!!
Sorry if this is a big mess but it makes sense to me and it works for me.
Click to expand...
Click to collapse
A lot of thanks!!! I'm looking for an explanation like this, all that I try give me an unusable framework-res.apk and now I know why.
ephumuris said:
Now this recompiled apk will probably not work.
Click to expand...
Click to collapse
Apktool creates "clean" apks as you name them. There is almost no difference between application built from sources or using apktool. And almost no logical difference between original apk and rebuilt one (for most apps, of course apktool doesn't support some of them).
If you are talking about system apps, then your problems are most probably related to incorrect way of installing resulting apk, not to it's structure. You can't reinstall system app easily and one of workarounds is to copy AndroidManifest.xml and META-INF from original file and push it to a device. Actually you did this using your method and I think this is the reason, why you think there is something wrong with apks built by apktool.
hey guys.
i've been getting into modding apps to match my liking. i've modded widgetlocker, sms unread count, ported the cm6 mail app and modded it, and also lookout. pretty much what i'm doing is changing .png's. i've done it by openining the .apks with apk manager, editing the .pngs, zipping and then signing it. then i install and bam, everything works.
however, now i'm trying to mod MixZing and i'm having an issue. bear with the long explanation:
tried the regular method using .apk manager. if i unzip/edit/zip/sign and try to install, i get "Application not installed"...if i do unzip/edit/zip as system app (no signature) and try to install, same message. if i do unzip/edit/zip as regular app but dont sign it, same message. if i edit the file with 7Zip and try to install, also get the same message...
if i unzip/edit/zip/sign and try to copy/paste over the existing .apk in /data/app i get force closes when i try to open the app.
now, if i edit the .apk with 7-zip and i copy it over the existing .com.mixzing.basic-1.apk in /data/app then it works! the widgets work, the app works. all is well....until i reboot the phone. then i come back and the app wont launch, as if it wasn't there.
i go to /data/app/ the .apk is there, but it wont launch. if i try to install it from there, it also gives me "Application not installed"...interestingly enough, when i try to install it, it tells me it would overwrite an existing application. yet when i go to the Market, it shows as Mixzing NOT being installed and lets me install a new copy just fine.
if i install again from the market, and copy/paste my copy over it in /data/app, it works again...until I reboot...and the cycle repeats.
what am i doing wrong here?
I am also trying to theme/mod apks to my liking. I am also getting the same errors as you are"application not installed ". I posted the same questions, yours are more detailed, on Riptides theme thread. Riptide has themed several add-ons that are flashed via recovery. I am waiting on a reply. Maybe check his thread and see if your questions are answered on there also...
Sent from my PC36100
No help or suggestions???
Sent from my PC36100
What files are you modifying? Are they *.9.png files? If so, they need to be decompiled, not just extracted so you can see the borders.
Sent from my PC36100 using Tapatalk
yeah the majority of the images edited are the buttons, all of which are .9.pngs. would that make a difference as to the app not installing? or the fact that it's recognized prior to boot but not after boot?
EDIT: i decompiled the .apk with APK Manager. replaced the .9.pngs with my own. tried to recompile and when it was about done it gave an error. after that it allowed me zip the apk. when i went to install, got the same message..."application not installed"...
why this issue with MixZing and not Lookout, SMS Unread Count, CM6 Email, WidgetLocker???
Max_Pain said:
yeah the majority of the images edited are the buttons, all of which are .9.pngs. would that make a difference as to the app not installing? or the fact that it's recognized prior to boot but not after boot?
EDIT: i decompiled the .apk with APK Manager. replaced the .9.pngs with my own. tried to recompile and when it was about done it gave an error. after that it allowed me zip the apk. when i went to install, got the same message..."application not installed"...
why this issue with MixZing and not Lookout, SMS Unread Count, CM6 Email, WidgetLocker???
Click to expand...
Click to collapse
Ok, .9 png files are not normal image files. To make a long story short, they are special image files that contain meta-data. Usually this meta-data is used to tell the widget where to stop and start (basically borders). Developers use .9 png files instead of hard-coding the borders to make it easier and more flexible for widgets and other images to display on a wide variety of devices.
When you extract .9 files, you will not see the meta-data. Chances are what is happening is when you are modifying the .9 files, you are also erasing the metadata. All .9 png files must have either a black border on the edge to tell the application where the border is, or it must have a white (blank) border surrounding the image. When you decompile the images, you should see some black lines on the edges of the .9 image files (make sure you are using APKManager 4.9).
So, when editing .9 png files, you have 3 options:
1. The easiest is to simply edit it the way you have been and remove the .9 filename. So for example, if the file is called background.9.png, rename it to background.png. This works about 50% of the time.
2. Decompile the .9 png file to see the borders, edit the image file and either keep the existing border or make your own black border on the edge (it doesn't need to be thick, just a small black line will do). The only problem with this is that sometimes you can see the black lines after it is compiled again.
3. The best way, IMHO, is to make a blank edge on the border of the background. This will avoid any compiling errors and eliminates the chance of seeing the black border. It doesn't need to be thick, just as long as the app can distinguish the border.
thanks for detailed post. will look at it with more time tonight or tomorrow.
i tried quickly now but didnt work.
i decompiled the apk using apk manager 4.9, i was able to see the .9.pngs with the black border. i changed all the extensions to just be .png for all of them. then edited them all in photoshop (make them clear is all i want), saved, and recompiled. for the first time APK Manager didn't give me an error. got all the way to asking me if it was a system app. i chose no. then i signed the app. again, no errors from apk manager. but when i tried installing, again got "application not installed"
ahhh...
will try other methods from your post later. if you have an idea as to why my first attempt didnt work i'm all ears.
Max_Pain said:
thanks for detailed post. will look at it with more time tonight or tomorrow.
i tried quickly now but didnt work.
i decompiled the apk using apk manager 4.9, i was able to see the .9.pngs with the black border. i changed all the extensions to just be .png for all of them. then edited them all in photoshop (make them clear is all i want), saved, and recompiled. for the first time APK Manager didn't give me an error. got all the way to asking me if it was a system app. i chose no. then i signed the app. again, no errors from apk manager. but when i tried installing, again got "application not installed"
ahhh...
will try other methods from your post later. if you have an idea as to why my first attempt didnt work i'm all ears.
Click to expand...
Click to collapse
I know what the problem is. You need to uninstall the previous version before installing the modified version. Even though they are the same app, the signatures are different, so they won't overwrite. I make that mistake a lot too.
uninstalled mixzing, tried installing my signed copy and again, application not installed.
does it matter that i mixed the renaming of the 9.pngs to just .png from step 1 to the decompilation of the .apk from steps 2 and 3? maybe i should just rename the .9.pngs through 7zip without decompiling?
any more suggestions?
to test out a theory, i did the following:
1) extracted .apk with apk manager, changed 4 .png files that were not stretchable .9.pngs. zipped .apk, option 2, then signed .apk.
i uninstalled my working version of mixzing, tried to install this one, and got application not installed.
2) i decompiled .apk with apk manager, changed the same 4 .png files, recompiled apk, non-system app option, signed .apk.
mixzing was still uninstalled, tried to install this version, got same application not installed message.
neither of these tries including any .9.png modifications and still failed?
my first attempt into creating a new theme it's just a swype keyboard however i get fc when i try to open it. i am on starburst 1.95 i wipe after applying before launching. i modded png files compressed them originally i thought the apk being 6 megs was my issue but i have the same issue after compressing them. I didn't know if the apk needed to be resigned so i first tried without signing then with signing with the same result. can someone help me find what i screwed up.
didn't download your file to look but did you change any .9.png's ?
if all you changed were png's the .9.are probably causing your problems.
try this.
if just changing normal pngs just unzip the .apk (its a zip file) edit your png files and zip it back up.
see if that works.
once you get that going there are quite a few good tutorials out there on modding .9 files.
they take a few extra steps.
they are all .png
i have noticed swype themes for other phones don't completely work or they don't swype at least, but they do work for standard typing. my failed theme however just force closes so i am thinking this is a different issue not necessarily compatibility. the swype i modded was pulled from starburst, my current rom.
their is a com.swypeinputmethod file under data/data i am not sure if or how this effects the swupe.apk in system/app. thanks for the reply
try replacing the png files without decompiling the .apk first
just rename .apk to .zip and extract to a folder then rezip and change back to .apk
or easier just open the zip without extracting and copy the files to thier spots and close.
this way you don't have to worry about all the decompiling and signing.
it works
i got it
since it is a no install system app i just put it into the rom and installed the rom, i also got a fresh apk to dump the png's into not sure what did it but it is now working and i can look for something else to theme, skin or play with.
thanks guys
I was looking to theming some of my apps & thought I'd start out simple. So I decomipiled my LGDownloadsUi.apk (pull from decompiled system.img) & copied the necessary framework files, installed them, and decompiled.
I looked in the res/values directory found the colors xml & changed the text color hex code.
Upon recompiling the values folder is not in the new apk. (Since it's a system app I need to copy the new xml from the newly compiled apk to the original to maintain the sig.) I tried simply deleting everything except for meta folder & moving everything over, but that result s in getting stuck in tmo splash screen. Am I missing something? Is editing the values xml files only viable in non system apk's? Do they get compiled into another file perhaps?
My device is a LG G3 D851 running MM 6.0
For decompiling I'm using the latest version of apktool.
Also I created a custom zip containing app & priv-app no framework, as my phone already has the framework files. Do I need to flash the same framework files from the decompiled system.img as well over my current ones? Thanks for any help.
TheLogicalGamer said:
I was looking to theming some of my apps & thought I'd start out simple. So I decomipiled my LGDownloadsUi.apk (pull from decompiled system.img) & copied the necessary framework files, installed them, and decompiled.
I looked in the res/values directory found the colors xml & changed the text color hex code.
Upon recompiling the values folder is not in the new apk. (Since it's a system app I need to copy the new xml from the newly compiled apk to the original to maintain the sig.) I tried simply deleting everything except for meta folder & moving everything over, but that result s in getting stuck in tmo splash screen. Am I missing something? Is editing the values xml files only viable in non system apk's? Do they get compiled into another file perhaps?
My device is a LG G3 D851 running MM 6.0
For decompiling I'm using the latest version of apktool.
Also I created a custom zip containing app & priv-app no framework, as my phone already has the framework files. Do I need to flash the same framework files from the decompiled system.img as well over my current ones? Thanks for any help.
Click to expand...
Click to collapse
I discovered that you can edit those xml's build the apk, the copy android manifest.xml and meta folder into the build folder. Then rebuild the apk to avoid signature issues. Instead coping the edit xml's into the new apk.