apktool confusion

hlxanthus

Well-known member
May 22, 2011
1,790
411
0
Okay, this goes out to the devs in the community. Trying to use apktool for the first time. I believe I have it installed correctly. I mount the framework-res.apk to the system with

code
apktool if framework-res.apk


which seems to work, then I decompile with

code
apktool d framework-res.apk


That gives me my decompiled apk to modify. Then I go in to make my changes by adding my pngs and editing the xmls. I BELIEVE I have it right then go to compile with

code
apktool b framework-res.apk


And I get all these errors:

code
C:\Users\Christian\Desktop\ginger1.3NEW>apktool b framework-res.apk Exception in thread "main" brut.androlib.AndrolibException: brut.directory.PathN otExist: apktool.yml at brut.androlib.Androlib.readMetaFile(Androlib.java:142) at brut.androlib.Androlib.build(Androlib.java:159) at brut.androlib.Androlib.build(Androlib.java:154) at brut.apktool.Main.cmdBuild(Main.java:174) at brut.apktool.Main.main(Main.java:59) Caused by: brut.directory.PathNotExist: apktool.yml at brut.directory.AbstractDirectory.getFileInput(AbstractDirectory.java: 103) at brut.androlib.Androlib.readMetaFile(Androlib.java:138) ... 4 more C:\Users\Christian\Desktop\ginger1.3NEW>


Any advice on where I am going wrong?
 
Nice! Glad to see you trying this!

Build command is this:

Code:
apktool b framework-res

Leave the .apk off when building because your telling it to build the decompiled folder and the name of the folder does not have .apk at the end of it. ;)
 
Nice! Glad to see you trying this!

Build command is this:

Code:
apktool b framework-res

Leave the .apk off when building because your telling it to build the decompiled folder and the name of the folder does not have .apk at the end of it. ;)

Ok off topic, but REALLY glad to see part of Team hydro still in the optimus S forums here. Thanks jstntp and All the devs putting in time and effort for us addicts to use!:D
 
Nice! Glad to see you trying this!

Build command is this:

Code:
apktool b framework-res

Leave the .apk off when building because your telling it to build the decompiled folder and the name of the folder does not have .apk at the end of it. ;)

DUHH! well, continued to play around and tried apk manager and I managed to do the edits for the framework-res.apk that I needed (I think)

Now my issue is I need to edit a jar file, and the guide I was using says to use baksmali and i cant find any comprehensable info on even setting it up let alone using it LOL

Edit: Honestly I got as far as downloading the smali and the baksmali .jar files but for the life of me I cannot figure out what to do with then.
 
Last edited:
apktool will decompile that .jar file. That's what I use. android.policy.jar right? ;) I think I know what your trying to do.
 
Okay, how to I pack my framework-res.apk and android.policy.jar back into the zip to flash? Do I just unzip the rom, replace the files and rezip? I did try that it didnt do any thing. Normaly use peazip (cause I already had it), will try with 7zip
 
Basically yes that's one way to do it. But here, this is way easier to manage. This is a blank flashable zip, just put your files in the framework folder, turn OFF sig verif. and flash.

http://db.tt/HvRzgu2p
 
I started using APKtool yesterday for MIUI to change Miren Browser, to Browser so it can be the default icon.

It works, but it force closes. :(

Sent from my LG-VM670 using Tapatalk 2 Beta-5
 
Alright, I'm going to let you guys in on a little secret. Well, I'm not sure how much of a secret it is, but it took me a long time to figure out this technique about a year ago when I started. Been doing it ever since.

So, anytime you decompile, edit and compile any apk, your supposed to resign that specific apk in order for it to work. This is fine and all but I never could get a system apk signed and have it work. With what I'm about to tell you, you will NEVER have to worry about signing an apk EVER. I never do.

Once you try it a couple times, it will make sense.

So, once you have decompiled your apk and edited whatever and compiled, you end up with two folders inside the decompiled folder. "build" and "dist"

Forget about the "dist" folder and open the "build/apk" one. Now, shrink this window to one side of your screen and then open the original unmodded stock apk that you decompiled from. No need to unzip it, just open it with Winrar or 7zip. Place that window on the other side of your screen.

Ok, so in the "build" folder you have res , AndroidManifest.xml, classes.dex , and resources.arsc. (Some apk's won't have classes.dex)

If you did nothing to AndroidManifest.xml then forget about that, but go ahead drag all the others into the original apk to replace the existing files. The point is to not disturb the META-INF folder in the zipped original apk itself.

So, once your done placing your newly "built" files into the original apk..... that's it, your done! No need to worry about signing the apk, just flash it or adb push it to the system.
 
Lol, been there before. Take a break but hate to see you give up completely.

If I remember correctly when I did this for Your Mom Rom, I did it the same way that guide states. But, the only way it would work is if flashed as a mod after the Rom was installed and booted into one time. Each time I tried to include it in the rom and performed a clean install, it would not boot. Not too sure what exactly the problems are your running into, but thought I would mention that.
 
Lol, been there before. Take a break but hate to see you give up completely.

If I remember correctly when I did this for Your Mom Rom, I did it the same way that guide states. But, the only way it would work is if flashed as a mod after the Rom was installed and booted into one time. Each time I tried to include it in the rom and performed a clean install, it would not boot. Not too sure what exactly the problems are your running into, but thought I would mention that.

Honestly neither worked. I tried to include in rom, boot original rom then flash as a mod, also tried just the framework -Res.apk to see if atlreast it would boot. No luck. Please understand, I have very little knowledge of coding but plenty about working with various software.

Very frustrating when things don't work as expected, and the guides I'm working from are rather different then our device it seems to me.

Sent from my LS670 using Tapatalk 2
 
Well, I got the framework-res.apk to boot! Had to do a full install of the rom, and then flash the framework in afterwords (let fully boot to provision the phone first). Now I have get the android.policy.jar to boot !! Wish me luck
 
Is there some trick to get the .jar file to boot? I am like 99% sure I have it modded correctly, but every time I flash it just boots back to recovery. I assume it is because of signing issues, but I am not sure.

I tried to just move the modded dex file into the old android.policy.jar file without unzipping as you suggested but no dice.
 
Those .jar files have no signatures so you don't need to worry about that, and actually you CAN us the one that gets placed in the "dist" folder after compiling for those.

Go back to the regular setup of the rom and then get to flash framework-res and androis.policy.jar at the same time wiping caches only. If no dice, then something in android.policy.jar is likely wrong. The other thing you can do is decompile your newly modded framework-res and double check your public.xml file to make sure your resource values did not get changed upon compiling. Apktool WILL do that if the are not the right values to begin with.
 
I used apk manager to recompile framework-res.apk as it generates the public.xml hex keys I needed, then I decompiled it to retrieve them (copied the apk before so I had an untouched framework-res.apk). I copied those keys to use in the android.policy.jar file. If I sent you both files do you think you could look at them to see if you can tell where I went wrong?