yashsingh1/xdaforums huggingface dataset:
[G1 Android Development] rfgamaral:
It doesn't work... :(

I get this in logcat now:

I/PackageManager( 106): /system/app/Settings.apk changed; collecting certs
D/dalvikvm( 106): GC freed 5340 objects / 430744 bytes in 104ms
D/dalvikvm( 106): GC freed 1907 objects / 315112 bytes in 103ms
W/PackageParser( 106): Exception reading /system/app/Settings.apk
W/PackageParser( 106): java.lang.SecurityException: META-INF/MANIFEST.MF has invalid digest for AndroidManifest.xml in /system/app/Settings.apk
W/PackageParser( 106): at java.util.jar.JarVerifier$VerifierEntry.verify(JarVerifier.java:130)
W/PackageParser( 106): at java.util.jar.JarFile$JarFileInputStream.read(JarFile.java:130)
W/PackageParser( 106): at android.content.pm.PackageParser.loadCertificates(PackageParser.java:318)
W/PackageParser( 106): at android.content.pm.PackageParser.collectCertificates(PackageParser.java:451)
W/PackageParser( 106): at com.android.server.PackageManagerService.collectCertificatesLI(PackageManagerService.java:2023)
W/PackageParser( 106): at com.android.server.PackageManagerService.scanPackageLI(PackageManagerService.java:2056)
W/PackageParser( 106): at com.android.server.PackageManagerService.scanDirLI(PackageManagerService.java:1994)
W/PackageParser( 106): at com.android.server.PackageManagerService.<init>(PackageManagerService.java:584)
W/PackageParser( 106): at com.android.server.PackageManagerService.main(PackageManagerService.java:335)
W/PackageParser( 106): at com.android.server.ServerThread.run(SystemServer.java:135)
I/PackageManager( 106): Failed verifying certificates for package:com.android.settings

I also get this for HTCSetupWizard.apk, HtcDialer.apk and HtcContacts.apk. It's the files I'm changing... And if I get any errors like the above, those apps won't work properly... For instance, I press on "Phone" and a little toast pops-up saying "Phone". I press "Menu » Settings" and I get a message saying that app is no longer installed.

I know my changes are working fine because if I sign every APK, they work just as they should... And when I do sign every APK, I don't get any "error" messages in the logcat.

P.S: Since it's a ROM i'm cooking, I'm always pushing the changes through recovery by flashing the whole ROM update.zip, wiping everything in between...
[G1 Android Development] Daneshm90:
Hmm so this is interesting, perhaps the first time a system apk is *read* it needs to have a matching manifest corresponding to its digest. Once its done creating the dex in dalvik, then perhaps mismatching its contents wont threaten its functionality. So try this :

Wipe

Flash the rom with all its original apks

Then flash the update.zip with ur modified apks (modified manifest)

See if that works.
[G1 Android Development] rfgamaral:
It will suck if it works that way...

Then I'll have to release "2 ROMs" and both should be flashed... There must be another way... :(

But I'll try it just to see if it works...
[G1 Android Development] rfgamaral:
While I'm still flashing and testing what you said...

Like I said, when I signed

every single

APK, everything besides one little thing worked, that's why I came here when I tried to do my changes without signing

anything

.

The problem was that the HTC widgets that one can download from the built-in downloader (in HTC ROMs) was not working because all APKs with

com.htc.rosie.uid.shared

shared uid were signed and they didn't match the ones downloaded. That was the only thing (that I could notice) not properly working when I signed everything.

So, I've already prepared an update.zip with everything signed but all APKs with that specific shared uid. It's basically all HTC widgets and Rosie.apk. If that works, (which I believe it will but you never know) I think I might go that route...
[G1 Android Development] Daneshm90:
Nazgulled, originally when u tried signing the apks with that uid and u posted that log, did u then try signing all the apks that the log complained about having mismatched signatures for that uid ?
[G1 Android Development] rfgamaral:
First of all let me tell you that your idea worked. Flash the original followed by the modified one and my changes worked just fine. But as you understand, this is not solution to share a ROM...

Now, I'm not sure I understand your question...

This whole debacle started when I tried to install the HTC Battery widget, which did not work. I had every APK in /system/app and /system/framework signed. That's when I realized that I signed APKs with

com.htc.rosie.uid.shared

, which are shared in the downloaded widgets and all of them must have the same signature; that will not happen for downloaded widgets, unless I do all the process manually, which defeats the whole porpuse of the widget downloader.

Then I decided to

only sign the modified APKs along with the ones that share the same user id

. After a day of testing and failing a bunch of things, I decided to post here...

The first logcat I posted is from an update.zip where only the modified APKs and the ones that share the same uid are signed, nothing else is signed (by me of course).

That's what I don't understand... If an APK is signed by me and then I sign all others that share the same uid, why does it not work? But it does work if I sign all of them, it's weird. There must be something else besides signing all APKs with the same uid...

If that did not answer your question, please rephrase...
[G1 Android Development] Daneshm90:
Correct this is not a viable solution, although if the changes u've applied to the apks are based on preferences, then some ppl might want it and others might not, in which case this becomes a perfect solution ( to just flash that zip on top)

Now, looking at ur first log,

E/PackageManager( 97): Package com.android.htcdialer has no signatures that match those in shared user android.uid.shared; ignoring!

E/PackageManager( 97): Package com.android.htccontacts has no signatures that match those in shared user android.uid.shared; ignoring!

E/PackageManager( 97): Package com.android.globalsearch has no signatures that match those in shared user android.uid.shared; ignoring!

E/PackageManager( 97): Package com.android.providers.contacts has no signatures that match those in shared user android.uid.shared; ignoring!

E/PackageManager( 97): Package com.android.providers.applications has no signatures that match those in shared user android.uid.shared; ignoring!

So the apks u've modified, what is their shared uid ? is it android.uid.shared ? or is it something else ?

edit: it is that uid, so have u tried resigning those apks?
[G1 Android Development] rfgamaral:
Sure, but that's not what I'm after... There's lots of ROMs out there and you pick the one that suits you... Or do your own, which is exactly what I'm doing. If people like it, than it's fine, if people don't, it's fine too; but it's not my intention to make a ROM for the people. I'm doing this primarily for me, I just like to share it...

Yes, that's the one...
[G1 Android Development] rfgamaral:
By the way...

I also made some changes to some APKs with the uid

android.uid.system

and signed those APKs of course and all that share that same uid. For these APKs, it worked...

Only for those with

android.uid.shared

that it didn't...

Maybe I missed an APK with the shared uid but I don't think so, because I extracted (with apktool) all AndroidManifest.xml files from all the APKs and then used a Windows app to look inside all the files for that shared uid, I only found those files in the logcat, which were signed with the same key.

This is exactly the same process I did for

android.uid.system

, which worked...
[G1 Android Development] Daneshm90:
Right so i assume u've already tried signing

com.android.htcdialer

com.android.htccontacts

com.android.globalsearch

com.android.providers.contacts

com.android.providers.applications

???
[G1 Android Development] rfgamaral:
Yes, I signed all those. That's exactly what the first logcat I posted shows...
[G1 Android Development] Daneshm90:
Ok but ur saying signing ALL apks with the same key works ? So then only thing i can think of is ur missing an apk that uses that shared uid.

Btw, have u signed the framework apks ?
[G1 Android Development] rfgamaral:
But which one? I can't find any other APK which shares the same uid...

I've signed framework-res.apk only because that shares android.uid.system with other APKs I modified. I didn't sign com.htc.resources.apk because that doesn't share any uid (or so it seems by looking at AndroidManifest.xml).
[G1 Android Development] Daneshm90:
Not sure, u've checked ALL apks for shared:uid android.uid.shared ?

What i did a while back was write a small script to apktool extract every apk in that folder, then i used a small search-text app to look for a specific uid.

Im out of suggestions, ive heard signing system apps breaks a lot of things, like i

came across this thread a while back. The guy in the last post has the exact same issues as u, i dont know if theres a way around this :(
[G1 Android Development] rfgamaral:
Yes, that's what I did too, see the following pic:

http://i29.tinypic.com/14bsy6g.png

I've read that thread back to back and I can't understand what could break if I sign the system apps...

I have everything signed at the moment (everything besides the ones that share the rosie uid, so the widgets install through the downloaded manager) and I can login to Google and access the Market just fine...

I had that problem before (not being able to sign to Google) when I was trying to fully deodex my ROM using an HTC Kitchen found on this forum. I've been testing and in constant communication with the Kitchen's dev to try and figure it out. We finally did it and came to the conclusion that either sign everything or don't sign at all. Both methods would work...

That guy from the last post, I'm sure he missed something cause I have everything signed and I can login to Google and access the Market.

There's no way to tell if it's going to be OK or not, but so far, everything is working... You think something else might break?
[G1 Android Development] Daneshm90:
Only time will tell. I remember cyanogen said something about signing all apks with test keys, here :

Thats why i prefer leaving original signatures intact. So if its not causing issues why bother with it ;)
[G1 Android Development] rfgamaral:
But if I don't sign them I can't hack the files and do the changes I want...

However, on my ROM:

- I moved the maps app to /data/app and didn't sign it.

- VoiceSearch is downloaded from the Market, I included it in my ROM in /data/app and also didn't sign it.

But yeah, these are only 2 packages, there's lots of them that were signed though...

I don't know what to do, I really wanted to do those changes...
[G1 Android Development] Daneshm90:
Yea so if its a personal rom then why not just flash the changes on top of the stock rom. Otherwise just stick with signing all apks and see if after a few days of use anything breaks.
[G1 Android Development] rfgamaral:
I think I'm going to do just that, basically what you said earlier but slightly different...

My ROM won't have those changes by default and nothing will be signed, all warnings point to do that as a precaution for not screwing anything up. Then, I shall use small "update.zip"s to do those changes, instead of flashing a full fledged update with the modified files.

The signatures won't be intact, only the files I modified will be changed and the signatures/hashes will be the same, it's weird, but that's the only way to do it I guess. Since the ROM itself was already flashed, the hashes won't be verified when the small "update.zip" is applied.

There's no way around it I guess...

Well, it's personal but like I said, I'm going to release to the public anyways, some people might like it. Seeing if it breaks after a few days is out of the question, I don't have time to keep on configuring the whole thing over and over again. I already had everything configured when I realized my problem by signing everything Rosie related and now I'll have to do it again.

I tried to flash one on top of the other but since one package has all APKs signed and the other doesn't, the uids will be different and the whole thing will be messed up. I tried the fix_permissions script but it didn't work as expected. So I'm better off configuring everything all over again, I just don't want to do it many more times :P
[G1 Android Development] Brut.all:
I ain't a rom cooker, but I think you could include modded system apps without resigning everything. Try to include /data/system/packages.xml file in your rom.
[G1 Android Development] rfgamaral:
What do you mean? An empty file?

I've read on Cyanogen's wiki that if that file gets deleted or screwed that will be auto regenerated...

Anyway, I don't that will help because at first boot, the system will extract the classes.dex files to put them on the dalvik-cache and when it does that, it checks the signatures/hashes, so it will never bypass that.
[G1 Android Development] Brut.all:
No, not empty. I mean in this file are stored certs of installed apps, so if you will add info about an app to it, then maybe system won't check certs, because it will treat this app as already installed. This is the same situation as when you replace system app through update.zip method - then it's included in packages.xml with proper modify time, so system won't even look into certs.

Maybe, but... you could include whatever you want in your update.zip file. You could dump already installed and initialized system, make an update.zip from it, then wipe everything, install your update.zip and system will think that it was just rebooted, not installed a second ago. I may be totally wrong, but I think it should be possible to include a few files from data partition and then system won't do initialization steps (certs checking) for some apps.
[G1 Android Development] rfgamaral:
It didn't work, it entered in a boot loop, here's a logcat if you're interested:

http://pastebin.com/JEQhWtUR
[G1 Android Development] Brut.all:
I've just rebuilt your apk and resulting resources.arsc is of very similar size than original. That fact and your logcat makes me think that your resources.arsc is totally screwed up, but I have no idea why. It's hard to believe for me that apktool had built it without any errors.

This is the reason why I don't support mixed up apks - there are thousands of things that may be screwed up and I can't guess what.

Could you upload your resulting apk file?
[G1 Android Development] raspdeep:
ok, i will post the warnings, etc when i try to decode/build the apk later tonight with both v1.2.0 and v1.3..
[G1 Android Development] staunty:
I received an error when trying to build a file. Apktool is working great on my home PC but this is from a Mac that I use for work. It appears to be a problem with libSystem.B.dylib however, I've yet to find a suitable answer to the dylib problem. Has anyone else had a similar issue?

I: Checking whether sources has changed...

I: Checking whether resources has changed...

I: Building resources...

dyld: Symbol not found: _open$UNIX2003

Referenced from: /SDK/tools/aapt

Expected in: /usr/lib/libSystem.B.dylib

Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, -F, /var/tmp/APKTOOL21267.tmp, -I, /Users/ks/apktool/framework/1.apk, -S, /SDK/LatinIME/res, -M, /SDK/LatinIME/AndroidManifest.xml]

at brut.androlib.res.AndrolibResources.aaptPackage(Unknown Source)

at brut.androlib.Androlib.buildResourcesFull(Unknown Source)

at brut.androlib.Androlib.buildResources(Unknown Source)

at brut.androlib.Androlib.build(Unknown Source)

at brut.androlib.Androlib.build(Unknown Source)

at brut.apktool.Main.cmdBuild(Unknown Source)

at brut.apktool.Main.main(Unknown Source)

Caused by: brut.common.BrutException: could not exec command: [aapt, p, -F, /var/tmp/APKTOOL21267.tmp, -I, /Users/ks/apktool/framework/1.apk, -S, /SDK/LatinIME/res, -M, /SDK/LatinIME/AndroidManifest.xml]

at brut.util.OS.exec(Unknown Source)

... 7 more
[G1 Android Development] the3dman:
Can anyone who has this working try to decode this. I keep getting errors on decode and re-compile

On Decode I get:

the3dman@the3dman-desktop:~/Desktop$ apktool d TouchWiz30Launcher.apk

I: Loading resource table...

I: Decoding resources...

I: Loading resource table from file: /home/the3dman/apktool/framework/1.apk

W: Could not decode attr value, using undecoded value instead: ns=android, name=background, value=0x0108036e

W: Could not decode attr value, using undecoded value instead: ns=android, name=background, value=0x0108036e

Exception in thread "main" brut.androlib.err.UndefinedResObject: resource spec: 0x0108036e

at brut.androlib.res.data.ResPackage.getResSpec(Unknown Source)

at brut.androlib.res.data.ResTable.getResSpec(Unknown Source)

at brut.androlib.res.data.ResTable.getResSpec(Unknown Source)

at brut.androlib.res.data.value.ResReferenceValue.getReferent(Unknown Source)

at brut.androlib.res.data.value.ResReferenceValue.toResXmlFormat(Unknown Source)

at brut.androlib.res.data.value.ResAttr.convertToResXmlFormat(Unknown Source)

at brut.androlib.res.decoder.ResAttrDecoder.decode(Unknown Source)

at brut.androlib.res.decoder.AXmlResourceParser.getAttributeValue(Unknown Source)

at org.xmlpull.v1.wrapper.classic.XmlPullParserDelegate.getAttributeValue(Unknown Source)

at org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper.writeStartTag(Unknown Source)

at org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper.event(Unknown Source)

at brut.androlib.res.decoder.XmlPullStreamDecoder.decode(Unknown Source)

at brut.androlib.res.decoder.ResStreamDecoderContainer.decode(Unknown Source)

at brut.androlib.res.decoder.ResFileDecoder.decode(Unknown Source)

at brut.androlib.res.decoder.ResFileDecoder.decode(Unknown Source)

at brut.androlib.res.AndrolibResources.decode(Unknown Source)

at brut.androlib.Androlib.decodeResourcesFull(Unknown Source)

at brut.androlib.ApkDecoder.decode(Unknown Source)

at brut.apktool.Main.cmdDecode(Unknown Source)

at brut.apktool.Main.main(Unknown Source)

On Re-Compile I get: (probably because the decompile had errors)

the3dman@the3dman-desktop:~/Desktop$ apktool b TouchWiz30Launcher

Exception in thread "main" brut.androlib.AndrolibException: brut.directory.PathNotExist: apktool.yml

at brut.androlib.Androlib.readMetaFile(Unknown Source)

at brut.androlib.Androlib.build(Unknown Source)

at brut.androlib.Androlib.build(Unknown Source)

at brut.apktool.Main.cmdBuild(Unknown Source)

at brut.apktool.Main.main(Unknown Source)

Caused by: brut.directory.PathNotExist: apktool.yml

at brut.directory.AbstractDirectory.getFileInput(Unknown Source)

... 5 more
[G1 Android Development] Daneshm90:
I used the one on the nexus forums when trying to make it fit on our g1 screens. That one has been removed of its dependencies with samsung's framework hence it decodes/encodes fine. If ur using one straight from the dump, u gotta include that other framework apk it has using apktool if command. Then it should work fine.
[G1 Android Development] JoOoSs:
Hi everybody,

I have many errors when i'm trying to decompile SlideScreen (a home) :

Anybody can help me ? :)
[G1 Android Development] Brut.all:
Try to install Android SDK and use aapt tool from it. If it won't work as well, then this is AOSP or your system issue. If it will, then maybe they have fixed something in r02, so I should update my installation packages.

What is weird, missing resources are from 0x01* package, not 0x02* as on SenseUI devices. Did Samsung merged its resources with AOSP resources? So f* smart!

Try to use baksmali directly and see, what's inside. I think it's this issue: http://code.google.com/p/smali/issues/detail?id=35 . If there are many files like: a.smali, b.smali, c.smali, etc. then you can't decode this apk on Windows.

BTW apktool has really simple CLI args parser, so options must precede apk-file-to-decode-arg. I think you did something like: "apktool d some.file.apk -f", so apktool used "-f" as name of destination dir ;-)
[G1 Android Development] raspdeep:
hi brut.all, is this a apktool bug?

i just do a "d" followed by a "b" and got this error:

Z:\apktool>apktool.bat d -f framework-res-v2.apk v3
I: Loading resource table...
I: Decoding resources...
I: Copying assets and libs...

Z:\apktool>apktool.bat b v3
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
Z:\apktool\v3\res\values\public.xml:947: error: Public symbol id/fill_parent dec
lared here is not defined.
Z:\apktool\v3\res\values\public.xml:1347: error: Public entry identifier 0x10202
73 entry index is larger than available symbols (index 627, total symbols 627).
Z:\apktool\v3\res\values\public.xml:1347: error: Public symbol id/mode_normal de
clared here is not defined.
Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutExce
ption: could not exec command: [aapt, p, -F, c:\temp\AppData\Local\Temp\APKTOOL7
680276317097683292.tmp, -x, -0, arsc, -S, Z:\apktool\v3\res, -M, Z:\apktool\v3\A
ndroidManifest.xml, Z:\apktool\v3\9patch]
at brut.androlib.res.AndrolibResources.aaptPackage(Unknown Source)
at brut.androlib.Androlib.buildResourcesFull(Unknown Source)
at brut.androlib.Androlib.buildResources(Unknown Source)
at brut.androlib.Androlib.build(Unknown Source)
at brut.androlib.Androlib.build(Unknown Source)
at brut.apktool.Main.cmdBuild(Unknown Source)
at brut.apktool.Main.main(Unknown Source)
Caused by: brut.common.BrutException: could not exec command: [aapt, p, -F, c:\t
emp\AppData\Local\Temp\APKTOOL7680276317097683292.tmp, -x, -0, arsc, -S, Z:\apkt
ool\v3\res, -M, Z:\apktool\v3\AndroidManifest.xml, Z:\apktool\v3\9patch]
at brut.util.OS.exec(Unknown Source)
... 7 more

using v1.2.0
[G1 Android Development] Brut.all:
Yeah, thanks :-)
[G1 Android Development] Phenombox:
I have a question;

I'm currently recompiling the X10Mini's Phone.apk in order to cancel the animation that makes the screen glow (when you want to hang up call you have to wait a couple of seconds for it to glow), however I haven't been successful in applying the new one and would like to clarify if I'm missing some apktool command or such.

I've installed my framework-res.apk which I pulled from the phone, afterwards I do de-compile command (which executes w/o errors), edit the required .xml and then compile it back (which executes w/o errors also).

The output Phone.apk is ½ the size (1105 KB) of the original one(2544 KB), but I guess that is just apktool's optimization.

Last step is I'm signing the .apk, I've tried with openssl keys and then APKManager's built in signing option, both executes w/o problem (on different Phone.apk's ofc!).

When I try to call someone, I get the "process has stopped; phone".

Is this something related to apktool or is there more steps that I'm missing here? :)

Cheers for reading,

Phenombox

EDIT: Looks like it's the resource IDs that gets messed up, any way to counter this or is this still unsolved?
[G1 Android Development] thatguythatdid:
brutall do you know what this error means http://pastebin.com/EqweD5wH
[G1 Android Development] Brut.all:
Can't find "aapt" command - this tool must be somewhere in your path. Did you unpacked apktool-install-windows-2.2_r01-2.tar.bz2 file to your Windows dir?
[G1 Android Development] fw0rd:
new version from youtube video?

hi brut.all,

I came across the Youtube video on your channel. It says it is 'apktool 1.0' which went a step further and made .java files, with the smali as comments in the code... I am interested in this functionality but cannot reproduce this with v1.3.1 which I downloaded from Google code... Is this in there and I am just using command line switches wrong? It would be nice to open up in the IDE and to see the framework and .java files.

If you did not release this yet I am wondering if you have plans to do so and when?

Thanks

fw0rd
[G1 Android Development] fw0rd:
ok. i would like this much if you would show this option as 'experimental' so i can try it and maybe i will have some ideas to share :O)
[G1 Android Development] myn:
Looks good. I also like how you made the clock app have a transparent background :)
[G1 Android Development] seaweeduk:
That was cyanogen I just changed the widget style and size :-)