[Solved] smali changes not compiling - Android Q&A, Help & Troubleshooting

I don't know if I'm doing something wrong or missing a step but I'm trying to get my status bar transparent following this guide
http://forum.xda-developers.com/showthread.php?t=1523703
I'm using wanams apk manager, I make the changes to the statusbar.smali file and the xml files, I compile and it doesn't work on my phone, so I decompiled the modified apk, and the changes to the xml files went through but the smali files go back to the originals.
when compiling I use yes on Is this a system apk, yes to copy additional files, go to keep, delete resources.arsc and finish.
It happens with any smali file when I compile, I use notepad++ to edit the files.
Solved: So what I ended up doing since my xml files were saving but my smali files weren't, kindof a noob so I didn't realize that when compiling it asks to copy over files and the classes.dex file was overwriting all my changes to the smali files, so I compiled and when it asks to delete files from the keep folder I took the classes.dex from that folder, decompiled it seperatly made the changes to the smali files there. I still deleted my resources.arsc, then I finished making the apk opened the apk and replaced the classes.dex there with my modified one. pushed to my phone and everything works perfectly.

I don't know how it works for other files but try applying the same method somehow; When decompiling and recompiling framework-res.apk, there is a resources.arsc file that is created and placed inside a build folder under the original decompiled folder. Drag that resources.arsc to the NEW apk file you have, and it will work.
I assume you're decompiling a .jar file so maybe it's a classes.dex file. If there is a newly compiled one under some build folder, try placing it into the new .jar file. Make sure the compression method is STORE, or 0 if it's a scale. Try out some combos until it works out.

liinko said:
Solved: So what I ended up doing since my xml files were saving but my smali files weren't, kindof a noob so I didn't realize that when compiling it asks to copy over files and the classes.dex file was overwriting all my changes to the smali files, so I compiled and when it asks to delete files from the keep folder I took the classes.dex from that folder, decompiled it seperatly made the changes to the smali files there. I still deleted my resources.arsc, then I finished making the apk opened the apk and replaced the classes.dex there with my modified one. pushed to my phone and everything works perfectly.
Click to expand...
Click to collapse
Just delete the classes.dex from keep folder and press enter in apk manager menu.. and you're done

?
systemui with smali
in the whole forum not an any solution for compiling with smali

Related

Compile HTC.Resources

I am trying to add some .9 files and soem xml files to the drawable, drawable-hpdi folders respectivly, and i get compiles issues. What's the trick to this? I compile all day long with other apk's.
I get a ton of these:
ERROR: Failure processing PNG image D:\APK Manager 4.9\other\..\projects\com.htc.resources.apk\res\drawable-hdpi\appwidget_inner_focus_c.9.png
libpng error: Read Error
i believe you need to add the edited .9 files in after you compile. switch apk to zip and do it that way and then sign. atleast that is how i always have done it. compile with altered .9's always failed on me too.
RafficaX said:
i believe you need to add the edited .9 files in after you compile. switch apk to zip and do it that way and then sign. atleast that is how i always have done it. compile with altered .9's always failed on me too.
Click to expand...
Click to collapse
Thanx for answering.. But a bit fuzzy..
I actually have xml's to add to the drawable-hpdi and standard .png's not .9's to add to the drawable
I tried to just copy them over to the compiled version of the apk..
what do you mean switch apk to zip?
rename it to zip after you compile it, so this way you can open in winrar or 7zip and just drop those png's in the folders they need to be in. then rename name the zip to apk and sign it. the xml's can be in there when you compile it. they wont cause an issue.
like i said every time i made xml and png edits i had to do it this way to work right.
If you use 7zip there is no need to rename the file to .zip
Just right click on the file and choose 7zip - open archive.
Sent from my B.A.M.F. Thunderbolt
okay someone earlier in an email said never sign a htc.resources file.
Seems there could be several ways.
1. Open resources file with 7zip
2. copy png's to drawable folder
3. copy xml's to drawable-hdpi folder
then what?
thats it. bc its still an apk file through 7 zip. load it on your phone. i make sure it copies over the signature when it re compiles though. watch the output to make sure it did.
RafficaX said:
thats it. bc its still an apk file through 7 zip. load it on your phone. i make sure it copies over the signature when it re compiles though. watch the output to make sure it did.
Click to expand...
Click to collapse
Sorry being dense or just not getting it. You said re-compiles. If you are just opening the com.htc.resources with 7zip and copying files into it, how are you re-comiling?
The bits and pieces are confusing. PM me the exact steps to replacing png and xml in the resources file?
Dont you have to Zip align it? Or zip it? So it can be flashed from recovery?

Re-compile framework-res.apk (Custom Rom)

I got this figured out already, sorry about that.
Who ever thanked me, I wasn't posting a guide but a question.
I am trying from a fresh firmware base to learn from scratch but no idea how to get that framework to compile correctly.
did you install framework first?
Code:
apktool if framework-res.apk
Easy
I had problems with the apk tool and recompiling. The way I ended up doing it is:
I didnt decompile the framework-res.apk.
rename the file framework-res.apk.zip
open it with 7zip.
Extract the files you are wanting to work on
Do what ever work on the files you need done
Drag and drop the files back in the directories they go into while file is open in 7zip
Close 7zip
Rename file back to framework-res.apk
push to phone with adb
No decompile or recompile.
Hope this helps
Chadw1985 said:
I had problems with the apk tool and recompiling. The way I ended up doing it is:
I didnt decompile the framework-res.apk.
rename the file framework-res.apk.zip
open it with 7zip.
Extract the files you are wanting to work on
Do what ever work on the files you need done
Drag and drop the files back in the directories they go into while file is open in 7zip
Close 7zip
Rename file back to framework-res.apk
push to phone with adb
No decompile or recompile.
Hope this helps
Click to expand...
Click to collapse
If you just want to modify one of the 'normal' XML files or an image then that approach will work fine. The problem is he wants to edit the bool.xml file and that is contained in the 'resources.asrc' file and you need to decompile it first.
I am in the same situation although someone managed to edit the file for me and recompile it so I got there in the end, just not by doing it myself.
I followed the instructions you describe and the file never recompiled properly - or at least my device never booted with the one I recompiled
Try it like this:
1. Place APK in "place-apk-here-for-modding"
2. Choose "9" to Decompile
3. Grab resource "resources.arsc" from framework-res.apk
4. Do my edit in projects\framework-res.apk\res\values\bools.xml
5. Compile - Yes (system app) - Yes (copy files)
6. Go to "keep" folder and delete "resources.arsc" and the bools.xml file
7. Press any key
8. Either push by ADB or Root Explorer or Flash
nickiberli said:
Try it like this:
1. Place APK in "place-apk-here-for-modding"
2. Choose "9" to Decompile
3. Grab resource "resources.arsc" from framework-res.apk
4. Do my edit in projects\framework-res.apk\res\values\bools.xml
5. Compile - Yes (system app) - Yes (copy files)
6. Go to "keep" folder and delete "resources.arsc" and the bools.xml file
7. Press any key
8. Either push by ADB or Root Explorer or Flash
Click to expand...
Click to collapse
I have tried exactly like this and it didn't work for me. I downloaded lots of different APK tools and tried them all - there were comments about using older versions of apktool.jar etc. I kept getting different sizes of the output file depending on which one I used. I gave up in the end as someone edited the file for me and it was only one specific entry in bool.xmls I wanted changing. As far I could tell we were both doing exactly the same thing.
The last thing I said I was going to do was wipe the PC I was attempting to do this on. I never got round to doing it... I'd be interested to know why I could never get this working though
Andy
Give me the framework and tell me what u want to do.
I will do that for u
Btw is the framework ICS based?
Sent from my Micromax_A70 using Tapatalk 2 Beta-4
You have resigned?
Greets!

[Q] help editing classes.dex

First, my native language is not English, sorry.
I have been trying to modify the classes.dex in a specific app, can't manage it well.
First of all, extract classes.dex from apk and chage it to smali file(use baksmali).
Second, modify smali file, and then turn it back to classes.dex.
Finally, compress classes.dex into apk.
However, android cut off as soon as play after installing apk.
I thought how about if do not modify the smali file. So, No sooner had i transform dex into smali than retransform smali into dex. but it still not working after install. transformed dex's binary is even different from original dex's binary. Why is this happening?
Plz. Help me....

[Q] Decompiling APK's with renaming

Can you decompile APK with just renameing it to the ZIP or RAR files.
Then you can extract it and you get all the files inside the apk.
then you can edit xml files and simply rename it back to APK.
I was just wondering is this right and safe way or you shouldn't decompile it like that?

[JB]Xperia Sola 6.2.A.1.100 SemcPhone.apk Compile

Hi there,
I am using 6.2.A.1.100 Rom from DeathZeroFX on my Xperia Sola and I want to change the semcphone.apk caller image size.
I am using APK MultiTool v5.5.7 but although I am able to decompile it with no errors when I try to compile it, it keeps running forever. I have "installed" framework-res.apk, semcgeneric....apk and from folder (system/app) the systemui.apk.
I tried Apk MultiTool v4 and I got the same error with this http://forum.xda-developers.com/xperia-u/issues/decompile-semcphone-apk-t2118131.
All I want to do is change a value inside res/layout/somc_incallscreen_large.xml.
Even if I make no change same thing happens (v5.5.7) does not give me any error just keeps running..
In the decompiled)apk folder I get a new folder called "build" and inside there is only the classes.dex nothing else!
Searching the web does not say anything particular except for old aapt.exe version
I am desperate I even tried to compile the helloworld.apk (found on web which (de)/compiles with no problem) and just add my res folder but of course that could not happen.
Any suggestions?Or even another tool?I need to edit those @#$% android binary xmls..
Bingo
Despite being desperate, I used APK Studio and after decompiling I modified some of the xml, plus with the help of the previously decompiled java classes and the help of notepad++ I changed the corresponding code inside smali files and then build it. After that I copy pasted the edited files (from the apk) into the original one without signing and yeahaa happy reverse engineering..If I sign them with APK Multitool it will crash..(Though it is not clear if it should be signed again (for me crashes), somewhere says that by restoring the original META-INF and Manifest.xml will do the job (which does for me since the final apk is the original just with modified classes.dex).
I have a semcphone.apk with callers image (scaled down a little bit) instead of being cropped.
The last alternative was editing binary files through notepad++ hex editor which is a no go..

Categories

Resources