[Q] Can you edit/replace the classes.dex on the phone? - Android Software/Hacking General [Developers Only]

I am trying to edit an application however whenever i use apktool (apk manager) or smali/baksmali (jarsigner etc), sign then reinstall the app crashes..
So i am wondering if i can install the untouched package and then edit/replace the classes.dex while it is already installed?
Is that possible? Where exactly do installed apps reside? or do they remain in apk format until run on the phone?
I did search though i couldnt find an answer
Thanking you in advance.

Related

How does Android file system work (i want to replace some grahpics of a installed ap)

Hello,
i installed an application that uses png images files...now i want to replace some of them with mine. I can extract thoose pngs from the apk in windows with winrar fine. So i know the file name, but when i search for thoose files in Android they are not there. So where do my installed apps go in the Android file system? Do they stay in the apk? Can i modify them there? I tried modifying the apk before installing it wich resulted in a failed installation

[Q] Modding APK files / resigning?

Hi everyone,
After playing fieldrunners for a while I wanted to make some changes to the game. I openened the .apk file and edited the things i wanted. After that I cannot install that APK anymore. Is there any way to resign this apk again? Or some tweak to make it work again?
Thx
Morgenavond said:
Hi everyone,
After playing fieldrunners for a while I wanted to make some changes to the game. I openened the .apk file and edited the things i wanted. After that I cannot install that APK anymore. Is there any way to resign this apk again? Or some tweak to make it work again?
Thx
Click to expand...
Click to collapse
uninstall existing version,
place modified apk on sd card root,
sign your modified apk with signapktic using the platform key,
install via a file manager and you should be set.
Hi and thx for the reply!
I installesd the program and signed the apk as u explained but nothing changes. It still wont finish the installation. If I choose another output file ( another name and location ) it also says finished almost instantly but I never get a new file. Is this normal and will it only fix the existing file?
Thx
Got it working now. Not with the program but made a key and used signapk.jar
Thx anyways!

HELP with Decompiling APK (using APKTOOL)

I've looked around for some good tutorials on decompiling APKs using APKTool but haven't been able to get a few questions answered. Hoping someone can guide me with this process a bit since I'm really new at it.
A few things first: I am running CM 7.1 on a Droid Incredible (orig) and I'm also on Windows, not Linux. I'm looking to make some changes to the code of an APK and have APKtool downloaded. Questions I have so far are:
1) Do I need to use the CM 7.1 framework-res.apk file for any decompiling / /recompiling work on this 3rd party APK? Or can I do all the work without it? No one seems to have a clear answer on that and I'm not sure exactly what the framework-res.apk is for exactly.
2) After I decompile an APK and make code changes to a SMALI file, is there anything I need to do special before running the compile command?
3) After I have a newly compiled APK, what do I need to do to make this work on my phone? If I do nothing, the overall file size of the compiled APK seems much smaller than the original one that I decompiled so it seems like something is wrong. Plus it won't install. I saw one video where the newly compiled APK is renamed to .ZIP and the contents are put into the ORIGINAL APK (also renamed to .zip), overwriting all the original contents. Is this required?
4) I've also read that APKs need to be signed to install on Android. Is this correct? I found "SignApk" online which seems like it just asks you to rename your APK to app.apk and it does the signing by running a .BAT file. Is that all I have to do before installing the APK on my phone?
Would really appreciate any help on this. Or if there's a great tutorial out there on doing this, I'd be happy to read through.
Thanks for any help in advance!
I want to know these too! Hope someone helps

[Q] HELP! How do I sign an .apk file?

Here's the deal...I downloaded youtube v2.4.4 from here. I opened it in 7zip and extracted the res folder so I could re-theme it. I made my changes then put the res folder back into the original apk. Now this is where the problem occurs. I can't for the life of me figure out how to re-sign the .apk! I have tried every single apk-signer out there to no avail. I have put it in apkManager then decompiled it optimized PNGs recompiled then signed then zipaligned but EVERY time I install it on my phone I get either "Application not installed." or "There is a problem parsing the package." I have uninstalled all versions already on my phone through Titanium Backup prior to installing my themed one. I have manually put it in /System/app and changed permissions and rebooted. NOTHING I do works. I have adb and java installed and in the PATH. I have tried every possible solution I have found on the internet and none work. Any help would be appreciated. Thank You!
P.S. I have an HTC Thunderbolt running the latest build (3/17/12) of ThunderStick Full Blown Sense 3.0 (Thread for this ROM here)
Here is the edited res folder - Maybe someone can look at or use it for troubleshooting.
Thanks again for any input on this problem.
go to market and search and download zipsigner2. open it and navigate to the app and then chose and output and save it as an .apk file and it should install like normal

Modifying system apks / resigning

Hello,
I a quite new to Android development/hacking and need some clarification regarding signing system apps.
I did not find any answer yet that fully helped me solve my problem...yes, I did use search on the forum and even Google :laugh:
Scenario:
Let's assume I wanted to modify some system apks (in /priv-app or /app doesn't matter).
All those apks I want to modify do rely on the same framework.apk.
As far as I know, if I modify a system apk all other system apks that rely on the same framework.apk have to be resigned using the same certificate.
1) Is this correct (any pitfalls there)?
2) Do I have to resign the used framework.apk with the same certificate also?
3) Do I have to take other files/things into consideration that would have to be changed / resigned / etc.?
Thanks in advance! :good:
Regards
Markus
deomaki said:
Hello,
I a quite new to Android development/hacking and need some clarification regarding signing system apps.
I did not find any answer yet that fully helped me solve my problem...yes, I did use search on the forum and even Google :laugh:
Scenario:
Let's assume I wanted to modify some system apks (in /priv-app or /app doesn't matter).
All those apks I want to modify do rely on the same framework.apk.
As far as I know, if I modify a system apk all other system apks that rely on the same framework.apk have to be resigned using the same certificate.
1) Is this correct (any pitfalls there)?
2) Do I have to resign the used framework.apk with the same certificate also?
3) Do I have to take other files/things into consideration that would have to be changed / resigned / etc.?
Thanks in advance! :good:
Regards
Markus
Click to expand...
Click to collapse
All system apps have to be signed the same way, yes. You can sometimes mod your services.jar to turn off signature verification but that can leave you a bit more open to malware.
When you mod a system app, you just have to make sure you use the original signature in the new version. The only exception to this is if you change anything in the manifest. Then you will need a new signature, which means either signing everything else with that signature or doing the services.jar I mentioned earlier.
Hello Ticklefish,
first of all: Thanks a lot!
To summarize your answer:
1) Modding services.jar is out of the question! Would never have done this anyway...(risky from a malware point of view)
2) In case I modify a system apk WITHOUT altering the manifest.xml I can reuse the old apk signature for my new apk (the whole META-INF folder has to be copied over to the new apk?)
Nothing else has to be adjusted?
I suppose I still can do a zipalign afterwards in that case?
3) In case of modifying the manifest.xml I would have to resign ALL system apks.
All of them or only those that rely on the same framework as the modded apk?
Do I have to resign the framework apk as well?
I am asking, because I will have to mod several apks relying on different frameworks: At least one where I have to alter manifest.xml...
Thanks in advance
Markus
deomaki said:
Hello Ticklefish,
first of all: Thanks a lot!
To summarize your answer:
1) Modding services.jar is out of the question! Would never have done this anyway...(risky from a malware point of view)
2) In case I modify a system apk WITHOUT altering the manifest.xml I can reuse the old apk signature for my new apk (the whole META-INF folder has to be copied over to the new apk?)
Nothing else has to be adjusted?
I suppose I still can do a zipalign afterwards in that case?
3) In case of modifying the manifest.xml I would have to resign ALL system apks.
All of them or only those that rely on the same framework as the modded apk?
Do I have to resign the framework apk as well?
I am asking, because I will have to mod several apks relying on different frameworks: At least one where I have to alter manifest.xml...
Thanks in advance
Markus
Click to expand...
Click to collapse
If you're modifying an APK without changing the manifest, the best method is to use 7zip or similar to open the new APK and drag the modded files over to the original APK. That way you're still using the same META-INF at the same compression ratio.
Or use Tickle My Android (https://forum.xda-developers.com/showthread.php?t=1633333) to do it for you....cough...cough...
You can zipalign afterwards, just remember that any further changes will affect that zipaligning so you'll have to do it again.
As far as resigning the APK goes, all I know is that you have to change every file that uses the same key/signature as the app you resigned so that they all match.
I have to confess that I've never actually done this. I rarely change the manifest myself and, when I do, I disable signature verification. Yes, it makes you more prone to malware but as long as you're careful about what you install you should be okay.
deomaki said:
Hello,
I a quite new to Android development/hacking and need some clarification regarding signing system apps.
I did not find any answer yet that fully helped me solve my problem...yes, I did use search on the forum and even Google :laugh:
Scenario:
Let's assume I wanted to modify some system apks (in /priv-app or /app doesn't matter).
All those apks I want to modify do rely on the same framework.apk.
As far as I know, if I modify a system apk all other system apks that rely on the same framework.apk have to be resigned using the same certificate.
1) Is this correct (any pitfalls there)?
2) Do I have to resign the used framework.apk with the same certificate also?
3) Do I have to take other files/things into consideration that would have to be changed / resigned / etc.?
Thanks in advance! :good:
Regards
Markus
Click to expand...
Click to collapse
I usually use Mixplorer, (if you use your phone to de/re-compile). Click on compiled apk, select 'explore' and a new tab opens with the contents of the apk. Delete the manifest that was created in recompile, then go to folder with decompiled apk, /original, and long-press to select android manifest xml, and META-INF folder. Choose copy, and paste them into new apk.

Categories

Resources