[Q] Compiling services.jar from source? - Android Software/Hacking General [Developers Only]

I've got an idea for a mod I want to make. I know where to find the Java code in the AOSP. This afternoon I spent some time futzing around with framework-res.apk; I used apktool to uncompress/decompile it, made some goofy changes, rebuilt the .apk, then signed and pushed back to my phone successfully.
Now, I want to make programmatic changes. So I pulled services.jar, decompiled with apktool again, and got my .smali files. Unfortunately, I don't understand the format whatsoever. I'm trying to do something more complicated than simply changing colors/graphics.
I want to know whether I can download the Android source, make my modification to the Java file I need, and recreate a services.jar out of it all. Is that possible? If so, is there a tutorial somewhere?

Related

[Q] Extracting source from APK

Hi, I am trying to get the source code of the ToggleWidgets.apk that cames with my Motorola Defy+. I already read many things (since I am new user, I am not able to post outside links) but I was not succesful on doing it. What I did so far:
Copied the frame moto-res.apk, framework-res.apk, and blur-res.apk from my Rom.
Installed it on the apktool, apktool if ...
Runned apktool d ToggleWidgets.apk and it was correctly extracted into the dir ToggleWidgets
Now I was expecting to find a classes.dex file. But there is not, and I got stuck. If someone knows what should I do, or a link with things to clarify, I would be thankful.
I just renamed one of my apps with .zip and opened it, and the classes.dex file was in there. not sure if that helps or not.
@ronaldguilmet: It was the very first thing I tried. Interesting that in my case the file present. Thanks!
I guess the class files generated with the Android SDK uses obfuscation through Proguard. I think you cannot disassemble it.
PS: If you approved the previous answer please click on thanks.
thgramos said:
I guess the class files generated with the Android SDK uses obfuscation through Proguard. I think you cannot disassemble it.
PS: If you approved the previous answer please click on thanks.
Click to expand...
Click to collapse
I do not know why ToggleWidgets.apk does not include classes.dex file. But when I tried different applications, I could get the source code using dex2jar, and then jdgui.
eduardomucelli said:
I do not know why ToggleWidgets.apk does not include classes.dex file. But when I tried different applications, I could get the source code using dex2jar, and then jdgui.
Click to expand...
Click to collapse
did you manage to deodex it? if so, can you tell me how? I've tried differents methods with no success. My ultimate goal is to be able to use the Toggle Widgets in a custom ROM like CM9, I don't even know if this is possible without using the motoblur launcher. Could it be that you are trying to do the same thing? it's just that I like those widgets so much and I would like to keep them in a different ROM.

[Q] Find core/java/android/view/Surface.java

Hello,
I would like to know, how its is possible to find, for example the file core/java/android/view/Surface.java .
Sorry for that noob question, but I am really interested in Android Software Developement and when I look at the github-profiles of others I always find those directories and files, I do not find on my system.
I tried using the baksmali tool and baksmalied my framework.jar . Then I found the file /framework/android/view/surface.smali but there are mostly completely different commands, so I think, there must be another tool that can edit the framework.jar in another way.
I would be very thankful for help.
AFAIK, what your looking for is in source, so once a build is compiled, you will not find that file(or folder structure). When you decompile framework.jar, you will find mostly smali files, which makes looking at the code give me headaches...
What are you trying to do? Is this for ICS or GB? and have you looked into setting up a repo on your computer? If you set one up, you will then find all the java source files you are looking for, but then you must compile the files you edit.
netwokz said:
AFAIK, what your looking for is in source, so once a build is compiled, you will not find that file(or folder structure). When you decompile framework.jar, you will find mostly smali files, which makes looking at the code give me headaches...
What are you trying to do? Is this for ICS or GB? and have you looked into setting up a repo on your computer? If you set one up, you will then find all the java source files you are looking for, but then you must compile the files you edit.
Click to expand...
Click to collapse
what i am trying to do, is to add some features like the rotation animation for motorola milestone 2.1 . what i already have managed, is to add ics animations and 4-way-reboot, by editiong the framework-res and framework.jar .

Editing APK files

Hi i have read a few posts about editing apk files but most are only about editing the image files. i need to edit the classes.dex file inside the apk i have done this but when i try and install the apk it doesnt work is this possible to do? thanks
this is not to do anything illegal it is simply to make an android app i use equal to the iphone equivalent (there are less servers for the android app) so i basically want to change the url from the apk to the iphone url)
Cheers
morgs640 said:
Hi i have read a few posts about editing apk files but most are only about editing the image files. i need to edit the classes.dex file inside the apk i have done this but when i try and install the apk it doesnt work is this possible to do? thanks
this is not to do anything illegal it is simply to make an android app i use equal to the iphone equivalent (there are less servers for the android app) so i basically want to change the url from the apk to the iphone url)
Cheers
Click to expand...
Click to collapse
Tried signing the file after modding it?
Sent from my GT-S5360 using xda premium
Hi thanks for your reply, yes i have and it still doesnt work unfortunately
Use apktool to extract the APK, you'll get .smali files instead of classes.dex (this is the decompiled version). Edit these files appropriately, then repack the APK with apktool and sign it. Should work.
Does apktool require command line? if so it is too complicated for me
Yes, it does. If command line is too difficult, it's probably unlikely you'll be able to get this working I'm afraid. You could try this: http://forum.xda-developers.com/showthread.php?t=1619473
It's an IDE for editing APKs, might help. But honestly, the command line part is the easy bit
Just never had any luck with any command line stuff for android never works for me and i hate all the extra crap you have to install to use it. Thanks anyway ill see how i go.
morgs640 said:
Just never had any luck with any command line stuff for android never works for me and i hate all the extra crap you have to install to use it. Thanks anyway ill see how i go.
Click to expand...
Click to collapse
If you wanna do basic stuff wid apktool then its a reaaly easy tool.. The commands are really very small!
Apktool d xxxx.apk for decompile
Apktool b xxxx for compiling n ur done!
Even the complex ones arent difficult! Only the installing of apktool takes time and its the hardest thing in the whole procedure
Sent from my GT-S5360 using XDA
in theory apktool is faily simple. but if you compile for android 4.0 better prepare yourself for huge headaches and a couple of white hairs as this thing wont work. i know two solutions, one consists of a really stupid juggling with two versions, one old which you can barely find, and one new, decompile with the old one, compile with the new one. some guy made a mod though and it finally ends the trouble, but i haven't seen it officially pronounced, which made it so damn hard to find it, hidden in some internet forums. another problem was that aapt needs to be present in the same directory, error codes will just spew out a bunch of gibbersish and you will never know whats wrong so all thats left is trying. but once you got it working it is as easy as pie.
molesarecoming said:
some guy made a mod though and it finally ends the trouble, but i haven't seen it officially pronounced, which made it so damn hard to find it, hidden in some internet forums. but once you got it working it is as easy as pie.
Click to expand...
Click to collapse
You mean this: http://forum.xda-developers.com/showthread.php?t=1551236 ? (It was about two threads below this one at the time I posted this )
nice! i made myself little batch files for this. i just go "apkd skype" to decompile skype.apk and apkb skype for building it, zipping it, signing it. didnt even know theres a guy out there now.
SifJar said:
Yes, it does. If command line is too difficult, it's probably unlikely you'll be able to get this working I'm afraid. You could try this: http://forum.xda-developers.com/showthread.php?t=1619473
It's an IDE for editing APKs, might help. But honestly, the command line part is the easy bit
Click to expand...
Click to collapse
This program worked perfectly thank you so much

[Q] Any option to detect changes in apk files

Hello guys.
I am wondering if there's any option/programme/app that can detect changes in apk files.
For example:
A dev releases a mod for something, let's say swaps a .png files to a custom .png and shares the mod in a thread.
And i want the same mod but in a different .png.
Now i can ofcourse ask the dev to do it, which is easy but i wont learn anything.
So i decide to try to make it for myself, but having no past experience with android i don't know how to do it.
And here's where the app/programme comes in (if there is one, ofc). A software that can detect any kinds of changes after decompiling apk files. Now many of you know that apk files have several folders inside, and inside those folder are various files.
So this software (if it exists) could be able to detect changes in the modded apk compared to my unmodded apk, and tell me where exactly the change(s) have been made.
In this way i don't need to bother a dev, and i maybe start to learn how to mod special areas of my phones UI.
Thanks for any reply!
Good day!

[Q] Problem Modding APK

Hello guys,
I am modding an apk to bypass an update check.
I have this outdated APK that functions fine since the URL and query and site address remains same but whenever it checks for and update it crashes. The thing is the developer made it topnotch but since then left and his site was recently taken down so check update query crashes it totally. What I need to do is update just the one function where it brings up the GUI after start. Otherwise it keeps saying download update or crashes randomly at time of starting up.
Now I have been browsing for a day or two for all the tutorials and right now I`m hell lot of confused. I have downloaded many tools and dependencies but I dont know how to proceed. I will tell you guys what I have and what I need.
I have de-compiled the APK using "dex2jar", I had a .JAR file which I decomplied using JD-GUI-Windows now after saving source I have .ZIP file in which I made the necessary editing. Next I downlaoded APKTool.JAR and extracted resource files and XML files that can be read in text editor. Along with some .SMALI files.
Now I am not familier with SMALI language at all and editing in it seems rather complicated and on the other side I have the .JAR file that decomlied all the classes just fine.
MY QUESTION IS:
How do I recompile the files I have ? I have the main coding extraced using dex2jar so in java format and JD-Gui to in .ZIP files, and resources/XML files also decoded using APKTools. What do I do next to recompile the APK ?
In short I have plain text based java source code and plain text XML and other resource file. How do I recompile it ?

Categories

Resources