[Dev Help][Emergency]Regarding Modifying AndroidManifest.xml and signing system apps - Android Q&A, Help & Troubleshooting

I am trying to modify AndroidManifest.xml of settings.apk
But as we all know, if we modify that AndroidManifest.xml, we have to sign the apk so when I modify the AndroidManifest.xml and sign the settings.apk and push it then it doesnt get installed and I get a error in logcat saying there is a mismatch in signatures of the apk and system uid.
Then I tried restoring stock signatures but it still doesnt get installed and in log it says the apk has no signatures because I modified AndroidManifest.xml.
Do anyone have solution for this to sign system apps properly or any other workaround?

I came to know that every system apk and framework apk must be batch signed incase of editing the manifest xml.

I don't think that every apk needs to be re-signed. I've never done this, but my thought was that any apk that has an AndroidManifest.xml with the same original modified dates (you can check the dates with 7-zip) need to re-signed together. Won't it mess up some other apks that don't need to be re-signed if you were to re-sign everything? Please let me know if I am way off..
Also, note that there are other ways to invert the colors in apks besides editing the AndroidManifest... (i.e. edit the /values/styles.xml, /layout/*.xml, etc... can be a pain, but it works) - Sorry, but I guess I am assuming that that's what you are going after by editing the AndroidManifest in the Settings.apk... again, anyone feel free to correct me if I'm wrong on anything here - I am all for learning and sharing!

^^No I dont want to theme it or colorize it
I am adding new functionality for which some new permissions and activity declaration is needed in Manifest file
But if I modify Manifest and use stock signature files it doesnt install and if I resign it then it say signature mismatch with system uid.

Bump!!

I have edited the AndroidManifest.xml in the Settings.apk (for theme color change), and I did not re-sign it after compiling, I retained the originals.
And, it worked fine when I put it on my phone alone (with a flashable zip package), BUT (this is a big but), - it did not get installed when I put it in a ROM package together with all the system files. That's when the signatures become an issue... you need to then re-sign all, or nearly all apps and framework.
At least that's my experience...

Check out this thread.. http://forum.xda-developers.com/showpost.php?p=28475720&postcount=63
Sent from my phone's mind

Oh then I have to sign all system apks
Any other way?
Do you know how to sign with system key which will match system uid?

Only for AOSP ROMs you can resign and apks work. Samsung use closed source.....how could you ever match signatures? Also don't change the Manifest. Leave it. Who says you have to change it?
Note that its via the public.xml that you need to add these listings as to what the apk is now doing. No the manifest. Is it going to market? No so don't change manifest simple. If it is then it shouldn't really be a system app. Also you can disable signature checking within your ROM if that is all you are worried about. I have signed apks from the market that I have themed and then installed them to system and they work fine. Its the apks you use that have dependencies that WON'T work. I.e. apks like Samsung TWiz apks that listen for the system vold boot complete proprietary to Samsung or say an ASOP apk that is trying to chime into something that is framework related in a non-asop ROM.....this then becomes a permissions issue
---------- Post added at 05:09 AM ---------- Previous post was at 05:05 AM ----------
PS: I have edited androidmanifest anyway and apks still work fine.... upgraded the SNS apk to ensure it was fit for use above and beyond SDK 10

varun.chitre15 said:
I am trying to modify AndroidManifest.xml of settings.apk
But as we all know, if we modify that AndroidManifest.xml, we have to sign the apk so when I modify the AndroidManifest.xml and sign the settings.apk and push it then it doesnt get installed and I get a error in logcat saying there is a mismatch in signatures of the apk and system uid.
Then I tried restoring stock signatures but it still doesnt get installed and in log it says the apk has no signatures because I modified AndroidManifest.xml.
Do anyone have solution for this to sign system apps properly or any other workaround?
Click to expand...
Click to collapse
Did you figure out in the end? Still stuck with same problem as you

Related

Edited HtcDialer.apk, logcat SIGNATURE error and apk won't run

Modding a 2.1 Sense UI rom (Hero Based.... but more of a hybrid)
Hey, I've edited the AndroidManifest.xml of the HtcDialer.apk, repackaged, sign and first tried to adb push it to my phone - didn't work, tried adb install - parser error, so I repackaged the entire update.zip and reflashed - still didn't work.
Logcat shows this:
Package com.android.htcdialer has no signatures that match those in shared user android.uid.shared; ignoring!
Click to expand...
Click to collapse
I tried popping into recovery and running "fix apk uid errors" but it still throws the same logcat and the dialer won't open.
How do I fix this?
EDIT: I've got this problem, facebook sync and camera/video to fix, then I'll be releasing the fastest SenseUI rom you guys have EVER seen. No joke.
OK, I'm grasping at straws here - so I've also tried, through ADB, completely uninstalling it and rm'ing any traces, then I tried to adb install it and it still won't work, I get an ADB error:
INSTALL_FAILED_UPDATE_INCOMPATIBLE
But everything should be deleted! It shouldn't matter that the old and new signatures don't match, its an entirely fresh install!
I've also noticed that when I adb pu****, I get a list of the HTC apps that share that uid.shared - and at one point they all said "uid=10011" - now they all say "uid=10010". I'm trying to fix this back to he original to see if this is part of the problem, but I can't find this anywhere in the androidmanifest.xml for any off these apps (like contacts, phone, etc).
I know HTC has this shared id stuff for all of their apps, but there must be an easy way to update JUSt an androidmanifest.xml file with a single line to give it vibrate permission. Is there any way I can resign the modified .apk AS Htc?
I have a similar problem (probably the same), does anyone know anything that might help?
Take what was edited and open the original apk with 7zip just drag the edited files in the 7zip window it will ask if you want to add the files, click yes then close out 7zip now pack it up in a update.zip and sign.......Do not sign the apk leave the original signature in there.
Flash adn that should take care of it.

[Q] how to modd .xml files of a theme ?

Hi all,
I'd like to modify some .xml files in the Gingerbread Theme that are in the resources.arsc file. I'm using Apk Manager 4.9 and I'm unable to compile twframework-res and framework-res: a lot of errors appears and resources.arsc isn't rebuild. It seems that it's a problem of dependencies. What file(s) I need ? Is there a way ?
I have a lot of errors like this :
"......\public.xml:172: error: Public symbol drawable/ic_menu_account_list declared here is not defined."
I tried with all the 38 themes and it's the same thing.
Note: When i use apk manager with an app it works and resources.arsc is rebuild.
Thanks in advance
clarkkov said:
You should discuss this with the app developer, this is obviously app specific issue - and who is most likely to know this app the best(?). I think that framework.apk(s) depend on more .apk(s) inside the OS, i.e. they are not independent like the 3rd party apps.
Click to expand...
Click to collapse
Yes. It's strange because when I use apk manager with a stock framework apk (JPM for example) there are no errors and resources.arsc is rebuild. So there is no dependencies with the OS...
And all the modded themes are uncompilable ...
thx !
I found the reason :
The framework-res.apk contains corrupted .9.png's images files ...
And every theme posted around there were modified with the sames .9.png's corrupted files ! Someone forgot to use the tools to mod this king of files or forgot to compile them ...
So, to solve this and to be able to compile all the framework-res.apk you have to get back the non corrupted .9.png's files from stock ROM.
I think the same problem is also present in twframework-res.apk; I will see later.
cheers.

[Q] apk decompiled, recompiled, signed won't install

Hello,
I'm trying to hack an apk.
My first step was to use apk multi tool, and to just decompile and recompile it.
This is what i've done:
decompiling
recompiling (without any mod)
signing
No error appears during those steps.
But this new apk won't install on my phone !
If I check difference between the two apk:
all xml files are differents
.RSA and .SF have not the same name
classes.dex, resources.arsc and manifest.mf are differents
I don't understand those difference. can somebody help me to understand that and how to recomile a proper version ?
PS: This app is a french app that shows speed cameras on the road. However this app is now only showing a big zone and not the exact location for france. But it stills show precise location for other countries, so obfuscation is done at the apk level, and I already found where it is in the code, so i'd like to bypass it and recompile a "special' version
Thanx
Just a few quick questions. Is you phone set to install from sources than Droid market? You do know the newly compiled and signed project will be located in the "place_package _here_ for_Modding" folder and is named "Signed(yourappnamehere).apk?
Sent from my SAMSUNG-SGH-I727 using xda premium
Hi,
yes, i took the newly compiled apk in this directory, and yes my phone is set accept unknown sources.
When i install the apk, i first have the
- liste of phones serviesc that will be used
- then the install progress bar
- then the message "application not installed"
I guess there is some kind of protection in the sources...
I also noticed that the two apk - original, and resigned one - don't have same size.
The only difference is actually in the META-INF directory : the .RSA and the .SF files.
In the original application they are:
- IFOX_.RSA
- IFOX_.SF
But when recompiling, those files are:
- CERT.RSA
- CERT.SF
I'm shure the problem comes from here, but i'm too noob to analyse that...
So my proble can be sum-up by:
Why the recompilation doesn not give me the same RSA and SF file ??
Beware there are some modifications that you cant do on decs, expecially the packagename.
also beware to disable the "non-market" tag on the phone.
Yes, but for the moment i didn't make any modification:
Just decompiling, recompiling and resigning.
Maybe you want to tell that the apk name must stay the same ? (sorry my english is not perfect )
GOT IT WORKED !!!
You must first uninstall the previous application !
I was trying to install my new one over the old one, but the signatures are not the same !!!
Thanx everybody, and hope this will help somebody !
APK edit error 103
Ok im having a similar issue.
I know the file size is mismatched but ive never had this issue
as a test i only modded 1 thing but 4 files
changed a link in an html / changed an image and its name and the html included the link to the new name
when this failed i changed the manifest and the .sf to match the change i made with name but not the sha :"no clue here"
Tried...
APK multi tool ... and 7zip to make the mods
Tried... Bothsigned and unsigned.
Tried copying the sig from old apk to new with names corrected "notsha" fail still
Tried....
Origional APK installs no issue
Uninstall orig apk rebooted
Allow out side apps yes and no.both
using file manager explorer and root browser and es file manager
Copying directly to /system/app fail
copying to data/data/app/copy fail " yes it wont even copy to there"
Tried.. Multiple phones
I then tried a hex editor on the apk. And after changes install still fail.
I modded several other apk's even my framework but this is the first app that ha given me so many issues
This is an app to help elderly users access internet and the devs are AWOL and the project abandoned
Code:
https drive google com/folderview?id=0B5PggxVy7c8meDhrcjNJOGs5cFk&usp=sharing
Code:
www eldy eu/en/software/eldy-tablet/‎
"edited for posting "
The goal here is to make it more U.S. friendly its English base is geared to English UK and this does not help my family as we are in the U.S.
All i can get from logcat is error 103
Logcat shows package it.vegans.eldy has no certificate at entry AndroidManifest.xml ignoring
Knstallation error code 103
I tried apk multitool certify thing
i tried copying the certs from old to new apk
i tried modding the cert to correct names
So maybe im mentally challenged but i just cant figure this one out
---
Edit .
I attached a zip with original and modified apk's
All i want to do is simple html edits xml link edits and img changes since mostly the app is a series of pages.

[Q] Signing APKs/Themeing.......

So I'm trying to do a little themeing and I have some questions. For instance, if I modify idlescreen_base.apk, do I have to sign that and then also sign the .zip? I'm trying to do a full on theme, modifying every little part of the ROM. When do you have to sign the .apks and .zips? One thing I don't like is the bubble around the four icons on the lock screen, so I went in to modify that and then found more files to change and so it began. And so while I'm on it, why do some m10s decode and some don't? Gingeritis3D and ShiftS3NS3 v3.0 have a default folder, but others have Blue Sky, etc. The default folder that has sharedm10 will decode but the others don't. Just curious. I'm using ShiftS3NS3 v3.0 as my base ROM to theme, by the way.
TheBeardedMann said:
So I'm trying to do a little themeing and I have some questions. For instance, if I modify idlescreen_base.apk, do I have to sign that and then also sign the .zip? I'm trying to do a full on theme, modifying every little part of the ROM. When do you have to sign the .apks and .zips? One thing I don't like is the bubble around the four icons on the lock screen, so I went in to modify that and then found more files to change and so it began. And so while I'm on it, why do some m10s decode and some don't? Gingeritis3D and ShiftS3NS3 v3.0 have a default folder, but others have Blue Sky, etc. The default folder that has sharedm10 will decode but the others don't. Just curious. I'm using ShiftS3NS3 v3.0 as my base ROM to theme, by the way.
Click to expand...
Click to collapse
I'm not much of a themer, but I might be able to help you with the signing.
You have to sign an APK any time you decompile and recompile it. Alternatively, if you use apktool, build the apk, then take the META-INF folder and AndroidManifest.xml from the original apk and copy them to the /build/app folder of the decompiled apk. Rebuild and your apk is signed. Your essentially taking the signature from the original apk and copying it to the one you recompiled.
If you want the zip to flash, you have to sign it. If you remove anything from an already signed zip, you have to resign it.
orkillakilla said:
I'm not much of a themer, but I might be able to help you with the signing.
You have to sign an APK any time you decompile and recompile it. Alternatively, if you use apktool, build the apk, then take the META-INF folder and AndroidManifest.xml from the original apk and copy them to the /build/app folder of the decompiled apk. Rebuild and your apk is signed. Your essentially taking the signature from the original apk and copying it to the one you recompiled.
If you want the zip to flash, you have to sign it. If you remove anything from an already signed zip, you have to resign it.
Click to expand...
Click to collapse
That makes total sense. I get it now. Thanks!
orkillakilla said:
I'm not much of a themer, but I might be able to help you with the signing.
You have to sign an APK any time you decompile and recompile it. Alternatively, if you use apktool, build the apk, then take the META-INF folder and AndroidManifest.xml from the original apk and copy them to the /build/app folder of the decompiled apk. Rebuild and your apk is signed. Your essentially taking the signature from the original apk and copying it to the one you recompiled.
If you want the zip to flash, you have to sign it. If you remove anything from an already signed zip, you have to resign it.
Click to expand...
Click to collapse
Sorry I seen this thread, and was wondering if you use metamorph to theme if you add the META-INF folder and the AndroidManifest.xml to the respective theme will the .apk be able to be installed into the data/app folder?
Deftoolfinch said:
Sorry I seen this thread, and was wondering if you use metamorph to theme if you add the META-INF folder and the AndroidManifest.xml to the respective theme will the .apk be able to be installed into the data/app folder?
Click to expand...
Click to collapse
Not sure. I don't use metamorph so I can't help you there. Sorry.
Sent from my ADR6400L using xda premium
I don't use metamorph. I modify the .apk then flash in recovery. Meta and ninja morph aren't necessary once you get the hang of flashing .zips.

modifying system APK's for the atrix?

hey all, i'm starting to get into modding my atrix and i have some questions about modifying the system APK's. i've already deodexed /system/app and /system/framework with xUltimate. i'm using APK Manager in linux to decompile the APK's that i want to mod.
the problem comes when i compile the new APK and upload it to /system/app. the stock APK's are signed seemingly with a specific signature that the phone is looking for. APK Manager says to not sign the APK's that you intend to install to /system, but if you do choose to sign it, the certs that are used are not what the atrix is expecting. when i look for errors in logcat, its indicating that the package changed and that its trying to look for the matching cert within /data/secure.
how does one modify these system APK's, and keep the original signature intact? it looks like the manifest contains a sha1-digest signature of each file, which makes just copying/pasting the META-INF into the new APK not an option.
thanks in advance!
What I do is decompile to change xml's etc and then recompile without signing and then just drag the edited files from the new APK to the old one.
Sent from my MB860 using XDA
so does that mean it doesn't really matter that the sha1 signatures of the changed files dont get updated in the manifest?
is there not an agreed-upon method to do this that doesn't seem so "hacky" ?
Sent from my MB860 using XDA
I'm not sure mate. That's the way I found out how to do it and I've done translations and a few themes and framework-res systemui and settings have worked fine doing it the way I do it.
Sent from my MB860 using XDA

Categories

Resources