Rename an apk so you can install it twice - Android Software Development

I've been looking for a way to do this for the past couple days with no luck. Just to get any suspicions out of the way, I am not using this to steal someone else's work, it's for a workaround for a game that I'm trying to accomplish using two save files. I've tried going into the android manifest, editing the package name, and then resigning the apk with no luck (i just get parsing errors when I try to install). Is there any way that this can be done? or am I missing something?

It is not a simple matter.
APKs are managed by package name, not by file name, but you can't simply change the package name in the manifest of a compiled APK.
Even assuming you manage to do it without messing up the file, which is not a simple task, there will still be code referring to the package name, so the app will crash.
To put it simply, you would be better off getting your device rooted (if you don't already have root) and playing with the application data files if you want to cheat at some game.

Related

Re-signing with test-keys issue

I have been breaking my head on this one for a while, so hopefully someone can give me some pointers...
I'm having troubles re-signing a stock ROM with testkeys.
When I re-sign ALL apk files (in app and the one in framework) with test-keys I get the error : "ERROR/Sync(125): Google login service not found." at boot.
When I don't sign anything the ROM boots fine...
Code:
08-17 20:48:39.326: ERROR/Sync(125): Google login service not found
08-17 20:48:39.326: ERROR/Sync(125): com.google.android.googlelogin.GoogleLoginServiceNotFoundException: The Google login service cannot be verified.
08-17 20:48:39.326: ERROR/Sync(125): at com.google.android.googlelogin.GoogleLoginServiceBlockingHelper.checkGoogleLoginServiceVerificationLocked(GoogleLoginServiceBlockingHelper.java:271)
08-17 20:48:39.326: ERROR/Sync(125): at com.google.android.googlelogin.GoogleLoginServiceBlockingHelper.getLoginService(GoogleLoginServiceBlockingHelper.java:260)
08-17 20:48:39.326: ERROR/Sync(125): at com.google.android.googlelogin.GoogleLoginServiceBlockingHelper.getAccounts(GoogleLoginServiceBlockingHelper.java:347)
08-17 20:48:39.326: ERROR/Sync(125): at com.google.android.googlelogin.GoogleLoginServiceBlockingHelper.getAccounts(GoogleLoginServiceBlockingHelper.java:329)
08-17 20:48:39.326: ERROR/Sync(125): at com.google.android.providers.AbstractGDataSyncAdapter.onSyncStarting(AbstractGDataSyncAdapter.java:1178)
08-17 20:48:39.326: ERROR/Sync(125): at com.android.providers.contacts.ContactsSyncAdapter.onSyncStarting(ContactsSyncAdapter.java:1219)
08-17 20:48:39.326: ERROR/Sync(125): at android.content.TempProviderSyncAdapter$SyncThread.sync(TempProviderSyncAdapter.java:236)
08-17 20:48:39.326: ERROR/Sync(125): at android.content.TempProviderSyncAdapter$SyncThread.run(TempProviderSyncAdapter.java:210)
You don't need to resign the APK's.
The full update.zip should be enough =)
Though it is still quite a mystery why the Google Login won't work when signed with a test-key.
maxisma said:
You don't need to resign the APK's.
The full update.zip should be enough =)
Click to expand...
Click to collapse
That is correct, the ROM works fine when I sign the full update.zip
I just would like to know why this it is giving problems when you resign everything... I would be nice to know the exact reason behind this issue.
Is there any advantage to signing all the apks, or is this just an academic exercise? I tried (and obviously failed) when messing with the T-Mobile stock ROM but like you said it works fine without.
Amon_RA did you ever find away to get this to work? I'm asking because I've tried re-signing all the apk's in /system/app & /system/framework on my Rogers build so I could include irrenhaus' Advanced Launcher v17 as a HTCLauncher replacement. If it's flashed as an "update" after the the rom is setup, running, etc. It works fine. But as soon as you wipe, you start getting boot loops. When you resign every apk, it'll flash in the build fine, but you can't access the market or sign into google. It's not only me, but Soulife & Enomther have spent quite a bit of time looking into this also. So, before someone say's just throw it into the /system/app directory & re-sign the update.zip, you can't it because it won't work properly. Any suggestions would be appreciated! Thanks.
kb7sqi said:
Amon_RA did you ever find away to get this to work? I'm asking because I've tried re-signing all the apk's in /system/app & /system/framework on my Rogers build so I could include irrenhaus' Advanced Launcher v17 as a HTCLauncher replacement. If it's flashed as an "update" after the the rom is setup, running, etc. It works fine. But as soon as you wipe, you start getting boot loops. When you resign every apk, it'll flash in the build fine, but you can't access the market or sign into google. It's not only me, but Soulife & Enomther have spent quite a bit of time looking into this also. So, before someone say's just throw it into the /system/app directory & re-sign the update.zip, you can't it because it won't work properly. Any suggestions would be appreciated! Thanks.
Click to expand...
Click to collapse
Some of the google apps have a "Signature" that is checks against itself to see if it's been modified - you'd need toedit that to make them work
Amon_RA said:
That is correct, the ROM works fine when I sign the full update.zip
I just would like to know why this it is giving problems when you resign everything... I would be nice to know the exact reason behind this issue.
Click to expand...
Click to collapse
its because it needs a release keys signature to login not test keys ;-)
idk where i read it but i do believe it originated it in a thread by stericson having to do with theming android and why test keys wont sign some apps or files for them to work they need to be signed with a release keys version like the actual Google signature not their open source signature they give us to sign apk's etc
Hello everyone - I do development on the myTouch Slide, but I have a question related to this post: how do we re-sign the HTC resources file (com.htc.resources.apk) with test keys? I've essentially decompiled it and built it back (using apktool), then signed the resulting APK with signapk.jar using the test keys, but when Android is being loaded it's unable to find the 'Resources'. (I haven't even arrived at this so-called 'Google Login' error - the GUI won't even load due to an error in HTCLockScreen not finding the resources).
The reason this all came about is because I'm looking for an easy way to edit the file and perform any changes I want to it. The 7-zip method is hackish and is specific to Windows - I am looking for a way where I can go as far as to edit the XML files in the package, but the 7-zip method doesn't work for that (because the XML files are compiled).
Any ideas? Can people link posts related to this? Thanks.
EDIT: Ok, some people are probably going to point out that I can hex edit the file through 7zip, but I would rather not do that, especially since I do not run Windows for my Android development.
I've actually discovered that the reason 7zip works is because it technically doesn't follow zip format specifications. Once you edit a file from within 7zip and save the changes 7zip doesn't calculate the CRC of the new (updated) file. Android proceeds to load the APK because the CRC hashes in the zip file are still "correct", but really they're not.
While this doesn't answer my original question, it does provide a possibility of extending other (non-Windows) utilities with the sole intended function of hacking APKs.
EDIT: I'm not entirely sure this is correct information as I'm still trying to sort through the different actions that various programs (Android included) take on an APK, plus I can't find a specification of an APK file (other than people simply saying its "similar to a zip").
I been looking at this as well and hopefully can help. First look at my signature for a release key maker for those that wanna know. okay so this is just all theory but I been looking to resign all apks with the same signature my signature. Reason being is I'm helping to port froyo sense to sprint hero and there's alot of smali editing and resigning of apks. I have noticed while doing this that some proprietary apks have this in there android manifest xml "androidprotection:signature". I'm not a genious but i'm guessing that is what checks the signature or rathere requires it.
I also noticed that there is a keystore file in /system/bin (at least in sense roms ).
That might be where the signature is kept. But I'm thinking that if you disable the requirement for a signature in the android manifest you might be able to resign the apks I haven't tried this yet since I'm sure someone has some feedback annd it's 348 in the morning i'm going to bed

Need a means to compile apks

OK seeing as my computer currently doesn't work, I need to know if there is an app for my phone that will at least edit the contents of an apk, if not compile one. Anyone?
Also, if this is in the wrong section, feel free to move it, mods.
From my X10a running WB CM 6.1.3 V053
Realorasz said:
OK seeing as my computer currently doesn't work, I need to know if there is an app for my phone that will at least edit the contents of an apk, if not compile one. Anyone?
Also, if this is in the wrong section, feel free to move it, mods.
From my X10a running WB CM 6.1.3 V053
Click to expand...
Click to collapse
apk's are just renamed zip files.
If so, then is there an app that will directly edit zip files? And do they need to be set to store compression level? If so, is there an app that does so?
From my X10a running WB CM 6.1.3 V053
Realorasz said:
If so, then is there an app that will directly edit zip files? And do they need to be set to store compression level? If so, is there an app that does so?
From my X10a running WB CM 6.1.3 V053
Click to expand...
Click to collapse
yes, set to store...all you have to do is long-press the file and select rename...same to change it back afterward. I don't know about what app will allow you to set to store, but there are a TON of free zip apps. Check the market
I need to edit them though, and if I extract it edit it then zip it with an app, it's not set to store.
From my X10a running WB CM 6.1.3 V053
Root explorer can open xml files in apps but I don't think it can edit them.
After modding the contents of a non-system apk file i believe you'll have to re-sign the apk. I dont know of any way to do that on your phone, i am admittedly not an expert though. Ive modded icons and such for apps and the only way I could find out how to get them installed was to re-sign them on my PC and push back to the phone.
Sent from my X10i using XDA App
CMoney87 said:
After modding the contents of a non-system apk file i believe you'll have to re-sign the apk. I dont know of any way to do that on your phone, i am admittedly not an expert though. Ive modded icons and such for apps and the only way I could find out how to get them installed was to re-sign them on my PC and push back to the phone.
Sent from my X10i using XDA App
Click to expand...
Click to collapse
Yeah signapktic can sign on the phone, all I need is an app that either will, zip things set to store like in sundae or one that will directly modify the contents of the zip.
From my X10a running WB CM 6.1.3 V053
The files inside apk is I think encrypted. normal text viewers (ex. notepad) cant see it. and the resource files (styles strings colours ) are archived again. Btw it would be great if we have an app to disassemble them within 4n. Coz copying apk from and to to computer is a pain
akila87 said:
The files inside apk is I think encrypted. normal text viewers (ex. notepad) cant see it. and the resource files (styles strings colours ) are archived again. Btw it would be great if we have an app to disassemble them within 4n. Coz copying apk from and to to computer is a pain
Click to expand...
Click to collapse
Well making it a zip on my phone didn't screw anything up. I can still browse normally. What I need is a means to edit a zip without compressing it, like you have to for bootanimatjons and everything else.
From my X10a running WB CM 6.1.3 V053
I would suggest having a look through the market....download every free app you can find and see if any help. There are so many out there that I have no idea which would work for exactly what you will want it to do. Really, trial and error is the best way, sometimes lol
eclipse
I'm not sure I understand correctly, some previously mentioned are right on track.
Contents of an APK file are as normal zip files, extract the APK with winrar, 7zip or similar program.. make modifications and re-zip it and change the file name.
Important process called "Zip Align" optimizes the file for the APK format and helps to optimize and align the archive for memory mapping I/O ensuring the payload is delivered correctly, for more info - mmap
If you would like to reverse an APK file, I choose to use APKTOOL a Google hosted project and complete with it's own reverse engineering syntax called "baksmali" - This wraps AAPT - Android Asset Packaging Tool part of the android SDK - need this installed.
An issue exists with obfuscated Java classes. Meaning source code has been scrambled (obfuscation algorithm) enabling it be understood by a compiler but no longer is human readable. Another issue is Signing the APK file as most installers are to authenticate the issuing publisher.
To build an APK anyone only need's have the Eclipse IDE and Android SDK installed and you can do this without even having an Android device by using the emulator to build and test your application.
Happy play!
EDIT: Apk edit and Apk tool are both able to help in this situation also.

[idea/need info] Update WMAppManifest.xml on phone?

I know that during the installation process, xaps are scanned for any "illegal" capabilities in the WMAppManifest.xml file. Does anyone know what purpose this file serves after an xap has been installed on the device?
My thought is this:
Install an app with a non-elevated WMAppMAnifest.xml. Then when you launch the installed app, it updates the xml file with additional capabilities (Interop Services, for example) and exits. Then when the app is relaunched, it will have access to the new capabilities in the xml file?
What do you guys think? Has this been done before? is that xml file only used during installation?
compu829 said:
I know that during the installation process, xaps are scanned for any "illegal" capabilities in the WMAppManifest.xml file. Does anyone know what purpose this file serves after an xap has been installed on the device?
My thought is this:
Install an app with a non-elevated WMAppMAnifest.xml. Then when you launch the installed app, it updates the xml file with additional capabilities (Interop Services, for example) and exits. Then when the app is relaunched, it will have access to the new capabilities in the xml file?
What do you guys think? Has this been done before? is that xml file only used during installation?
Click to expand...
Click to collapse
i think i tried this way and app returned failure error
i'm sure about that any app have to check capabalities during installation but in launch times i don't know that phone check caps again or no.
best work to test is changing this file in an interop unlock full fs phone and see the re-action
Caps are written to package manager database & global account database. WMAppManifest isn't used after installation is finished.
Yeah, this method was tried long, long ago.
Besides, even if it worked and the file was checked later, all that would mean is that you couldn't launch the app anymore. The capabilities-vs.-unlock-level appears to be checked at every startup, not just at install.
@GoodDayToDie @ultrashot I figured as much, thanks for the info.
On a semi-related note, I just received a completely different HTC 8x (T-Mobile branded) back from HTC (5th time in for repair). If this one really works, maybe I can have some fun with my Lumia 521 and/or try to figure out how to unbrand/mod the 8x. I really want to add WiFi calling to the 8x, but I need to add some certs, a missing dll, and some reg keys.

Cannot Extract APK

First ok all, Move if not in the correct spot (Or Delete if against TOS)!
Unsure if this is possible but I'm trying to extract an APK (Not sure if I should mention the App, I Did purchase the app) to make a small change to the code. I Can get to a certain point of extraction and then it stops. The files I need to edit are extracteded however so I can change what I need to, but as files are missing, when I recompile the app does not launch.
Any thoughts? Suggestions?
I've tried both APK Studio & APKTools

What is the correct procedure for decompiling system APKs?

Hey guys.
Having some difficulty here with modifying system APKs without leaving them 'corrupt'.
Specifically with SecSettings and SamsungCamera6.
Only looking to simply modify the qmg icons for the time being.
Ticklemyandroid didn't really want to know with SecSettings. Tried using apktool manually after installing the framework-res.apk and still doesn't seem quite right. Also tried apk multi took. Even went as far as simply trying to past the qmg files into the existing APK with winrar but that really broke things.
I believe my issue is partly that things aren't decompiling properly, but also that I'm a little unclear of the correct procedure to recompile them afterwards without any errors or corruption if tapping on them to install (I'm not actually trying to install them this way, but I'm looking to get to package conflicts rather than package corrupt).
Edit: NVM. Seems like some kind of protection to prevent you from modifying and installing said APKS

Categories

Resources