How to keep signature after modify apk - Java for Android App Development

How to keep signature after modify apk?
Google said just replace the classes.dex and some files.
But I cant install the apk.

You cannot. And that limitation is there for a reason! That way nobody else than the developer himself can insert code and therefore malware into an app's code. The user will be notified that there's something wrong with the apk. It's more secure for the user and for the developer.
If you want to install your app though, uninstall the app and then you'll be able to install the new, modified apk.

If you happen to be using Eclipse, there is a setting to automatically uninstall the old app if they have different signatures. As somebody who bounces back and forth between computers (each use a different signature when running debug), as well as the live version of my app, this is incredibly helpful, as it saves about 20 seconds of having to go into settings and uninstalling.

You can keep the signature bynot modyfying the manifest. Also theres an window app taht called VTS. that can preserve the signature sir.

Related

[Q] making system apks Into regular installable apks.

I was wondering how to make a system apk such as idk the browser into a regular installable apk so that someone with no knowledge of pushing apks can install it along side their apk.
Generally system apps are just normal apps, only installed on a system partition. If you pull a system apk from a device, then you should be able to install it normally on any other device.
There are exceptions from this rule:
You can't install an app if you have it installed already. Many system apps are installed on most devices by default and this is the reason, why you can't install e.g. Browser.apk pulled from other device - most probably you have it installed already.
There are 2 solutions: you could remove system app before installation of new one or just replace it - but this isn't what you want. To create normal, installable apk you would have to modify its package name as I did with Google Maps.
Some system apps use system internals, private APIs or privileges, some additional libraries, etc. For example Settings.apk changes internal settings of OS - you can't do that in normal apk.
You can't easily move/install such apps, they're integrated with system.
thanks for this long great reply. So lets say I pulled my dialer apk changed the package name, could I install it on a friends phone NOT on the system partition ?
I'm trying to pull the dialer apk from gingerbread and port it into a normal apk using apk tool, but once and changed the package name and all that and compile it I go to install it on my phone but it says that it could not open it as an apk file. Any ideas?
Newklearx3 said:
thanks for this long great reply. So lets say I pulled my dialer apk changed the package name, could I install it on a friends phone NOT on the system partition ?
Click to expand...
Click to collapse
I think not. Note that Phone.apk is only one app that can dial, you can't add such feature to your own app, so most probably it uses private APIs to do that. It's integrated-with-system one. Same for Settings.apk and PackageManager.apk, but you should be able to pull Browser.apk, Launcher.apk, MMS.apk, Gmail.apk, Talk.apk, etc., change their package name and install on another device.
Ahh, there is one more group: SenseUI, Motoblur, etc. apps, which use additional framework resources: images, colors, texts. They won't work on a device lacking this framework, but it should be possible to make these apps framework-independent by copying all dependencies to app itself. Not that easy, but possible
Brut.all said:
I think not. Note that Phone.apk is only one app that can dial, you can't add such feature to your own app, so most probably it uses private APIs to do that. It's integrated-with-system one. Same for Settings.apk and PackageManager.apk, but you should be able to pull Browser.apk, Launcher.apk, MMS.apk, Gmail.apk, Talk.apk, etc., change their package name and install on another device.
Ahh, there is one more group: SenseUI, Motoblur, etc. apps, which use additional framework resources: images, colors, texts. They won't work on a device lacking this framework, but it should be possible to make these apps framework-independent by copying all dependents to app itself. Not that easy, but possible
Click to expand...
Click to collapse
Dude, you're amazing! So how would I go about porting the gingerbread dialer to workable installable apk?
I might be doing something wrong but I pulled the launcher and changed the package name and still the same error
Okay, i guess I'm not. I copied the apk ( unmodded ) from the rom zip and placed it on my SD card to install it and the same error, so there must be something wrong.
figured out it was the sdk version, got it to show up but wont install now.
im also interested in porting specific development apk, lets say.. CM Settings into a non Cyanogen. Tried that once by pulling CM*.apk and push it to other non Cyanogen but got cant be installed message.. any hints on this?
phoezies said:
im also interested in porting specific development apk, lets say.. CM Settings into a non Cyanogen. Tried that once by pulling CM*.apk and push it to other non Cyanogen but got cant be installed message.. any hints on this?
Click to expand...
Click to collapse
Use logcat as a start to see dependencies
XDA App

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.

Rename an apk so you can install it twice

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.

Download, Install and Delete the Apk programmatically?

I'm making an Android App where the requirement is to place the apk on the website from where the user can able to download it after finishing the download it will automatically install the app. Once the Installation finished it should automatically delete the apk from the device. In the same manner when someone download the app from Google Play. It will be appreciated if you give me a step by step approach, it would be good for me to understand the logic cleary as i'm new to Android Programming.
Please help me on this situation!
Thanks in Advance!!!!!
First of all, the apk is needed to run the app and you cannot install the apk automatically after downloading.
The user has to allow unknown sources in the settings and then install it manually.
Afaik you cannot delete the apk from the app.
Second: This sounds as if you want to do something illegal/install a virus and then cover the tracks. That's not what XDA is for.
I'm sorry if I am wrong, but it really sounds like that. Prove me wrong by explaining when this would be useful.

[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.

Categories

Resources