yashsingh1/xdaforums huggingface dataset:
[G1 Android Development] tommytomatoe:
Hey all,

I am having a terrible time resizing widgets and making them work for Sense. I am using Warm Z, sense 2.0, and I have resized Rosie to 5x5, 4x5, and 4x6. I am currently trying to resize Sense Widgets to fit these workspaces. So far, I am only successful in resizing the stock music app. For others, I either get a "No Room for Widget" error when trying to load widget, or I get a force close. Here is a logcat of my force close. Please help. Thank you so much.

I/ActivityManager( 107): Starting activity: Intent { act=OpenSettings cmp=com.htc.widget.clockwidget/.HtcClockSetting (has extras) }
E/ActivityThread( 107): Unable to add skin resdir=/system/app/Slate.apk
D/SurfaceFlinger( 107): Layer::setBuffers(this=0x5a5ab8), pid=107, w=1, h=1
D/SurfaceFlinger( 107): Layer::setBuffers(this=0x5a5ab8), pid=107, w=1, h=1
D/PhoneWindow( 1605): couldn't save which view has focus because the focused view android.widget.RelativeLayout@482977d8 has no id.
D/dalvikvm( 1678): Rosie launcher will have a 48MB heap
I/ActivityManager( 107): Start proc com.htc.widget.clockwidget for activity com.htc.widget.clockwidget/.HtcClockSetting: pid=1678 uid=9999 gids={3003, 3002, 3001, 1015}
I/ActivityManager( 107): No longer want com.svox.pico (pid 1299): hidden #16
W/asset ( 1678): Asset path /system/app/Slate.apk is neither a directory nor file (type=1).
E/ActivityThread( 1678): Unable to add skin resdir=/system/app/Slate.apk
D/AndroidRuntime( 1678): Shutting down VM
W/dalvikvm( 1678): threadid=1: thread exiting with uncaught exception (group=0x40025a00)
E/AndroidRuntime( 1678): FATAL EXCEPTION: main
E/AndroidRuntime( 1678): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.htc.widget.clockwidget/com.htc.widget.clockwidget.HtcClockSetting}:
android.view.InflateException: You must specifiy a valid layout reference. The layout ID @com.htc:layout/title_1 is not valid.
[G1 Android Development] djmcnz:
What's at "0x10b000b"?
[G1 Android Development] jermaine151:
/res/xml/power_profile.xml

From unedited public.xml:

<public type="xml" name="power_profile" id="0x010b000b" />
[G1 Android Development] djmcnz:
lol - free "thanks" because I hit the wrong button.

Okay, obvious questions... does '/res/xml/power_profile.xml' exist? And do all references in that xml exist?
[G1 Android Development] jermaine151:
LOL! I wondered why you thanked me. :) I'll give you one right back (edit: make that 2 thanks in return :D). Yes, the file exists in /res/xml and only contains the following:

<?xml version="1.0" encoding="UTF-8"?>
<device name="Android">
<item name="none">0</item>
<item name="screen.on">0.1</item>
<item name="bluetooth.active">0.1</item>
<item name="bluetooth.on">0.1</item>
<item name="screen.full">0.1</item>
<item name="wifi.on">0.1</item>
<item name="wifi.active">0.1</item>
<item name="wifi.scan">0.1</item>
<item name="dsp.audio">0.1</item>
<item name="dsp.video">0.1</item>
<item name="radio.active">1</item>
<item name="radio.scanning">0.5</item>
<item name="gps.on">1</item>
<array name="radio.on">
<value>0.2</value>
<value>0.1</value>
</array>
<array name="cpu.speeds">
<value>400000</value>
</array>
<item name="cpu.idle">0.1</item>
<array name="cpu.active">
<value>0.2</value>
</array>
</device>

Should those arrays exist in the arrays.xml file, because they don't? I don't get it since I didn't change anything.
[G1 Android Development] djmcnz:
No, they shouldn't need to be in arrays.xml because they're fully defined.

I wonder if resource ID's are being reassigned... I doubt it but that would produce the same symptoms.

Perhaps do a diff on the source and recompiled resources.arsc files? Or re-decompile the new one and see if it matches the old (source) one?
[G1 Android Development] tnpapadakos:
shot in the dark, but did you try apktool 1.3.1?

1.3.2 has been known to have a bug causing errant "\" symbols to be inserted where they should be "/" symbols instead during decompiling/compiling
[G1 Android Development] jermaine151:
First let me say thanks to both of you for replying. I will decompile the new apk and diff the resource files against the original. Then I will try v1.3.1.

Thanks guys!

EDIT: Pendo was able to add the 1% increments to my framework file. Thanks Pendo!!! :)
[G1 Android Development] he_stheone64:
I went through that exercise and most widgets (not all) worked fine, but since 3 out of 17 made trouble I discontinued that project. In any case did you change the mywidgetview.smali and edited the getSpanX and getSpanY lines? From my experience with most widgets (not all) that is enough, no need to edit any xml, once you`ve done these.
[G1 Android Development] EmptyCloud:
Hello, thanks again for the great tool :)

I'm having some problems with recompiling HtcDialer.apk. The file comes out at half the size of the original when I rebuild it with no edits.

C:\Apktool>apktool d HtcDialer.apk
I: Baksmaling...
I: Loading resource table...
I: Decoding resources...
I: Loading resource table from file: C:\Users\Zhenya\apktool\framework\1.apk
I: Loading resource table from file: C:\Users\Zhenya\apktool\framework\2.apk
I: Copying assets and libs...

C:\Apktool>apktool b HtcDialer HtcDialer.apk
I: Checking whether sources has changed...
I: Smaling...
I: Checking whether resources has changed...
I: Building resources...
aapt: warning: string 'browse_tab_label_call_history' has no default translation
in C:\Apktool\HtcDialer\res; found: cs da de el en_RU en_UA fi fr it
ja ko nb nl pl pt pt_PT ru sv th tr vi zh_CN zh_HK zh_TW
aapt: warning: string 'htc_callhistory_delete_all_msg' has no default translatio
n in C:\Apktool\HtcDialer\res; found: cs da de el en_RU en_UA fi fr i
t ja ko nb nl pl pt pt_PT ru sv th tr vi zh_CN zh_HK zh_TW
aapt: warning: string 'recentCallsIconLabel' has no default translation in C:\Apktool\HtcDialer\res; found: cs da de el en_RU en_UA fi fr it ja ko nb
nl pl pt pt_PT ru sv th tr vi zh_CN zh_HK zh_TW
aapt: warning: string 'recentCalls_empty' has no default translation in C:\Apktool\HtcDialer\res; found: cs da de el en_RU en_UA fi fr it ja ko nb nl
pl pt pt_PT ru sv th tr vi zh_CN zh_HK zh_TW
I: Building apk file...

I've tried using both versions 1.3.1 and 1.3.2 and I have htc.framework installed. Thanks in advance for your help.
[G1 Android Development] dying4004:
guys : i am trying to edit a theme. its a theme for sense 2.0. so i got com.htc.resources.apk installed. then i decompiled the acid.apk witht this command: apktool decode acid.apk

then i edited the images and the androidmanifest.xml to change the theme name. then i tried to recompile apk with this command: apktool b acid 1.apk and was showed these errors.
[G1 Android Development] pendo:
The first few lines tell you the problem:

C:\apk\Acid\res\values\public.xml:1235: error: Public symbol drawable/[B]zzz_textfi
eld_search_pressed[/B] declared here is not defined.
C:\apk\Acid\res\values\public.xml:1236: error: Public symbol drawable[B]/zzz_textfi
eld_search_selected[/B] declared here is not defined.

So in the values folder you'll find a file called public.xml. On lines 1235 and 1236, it has entries for those two drawables I bolded, but they don't exist in the drawables (or drawables-hdmi) folder.
[G1 Android Development] pendo:
I just downloaded your 2 attached files. I ran "apktool d" and neither generated any warnings or errors. I then immediately ran "apktool b" and the frame-res didn't give ANY errors, and the only 2 warnings I got with the keyboard were these missing translations:

aapt: warning: string 'alternates_for_cyrillic_ua_g' has no default translation in /Users/pendo/Desktop/ruKeyboard_2.0_r21_full-original/res; found: uk_UA
aapt: warning: string 'alternates_for_cyrillic_ua_he' has no default translation in /Users/pendo/Desktop/ruKeyboard_2.0_r21_full-original/res; found: uk_UA

This was done using apktool 1.3.1, and as far as frameworks installed (apktool if) I have too many to remember, lol.
[G1 Android Development] tommytomatoe:
Thank you for taking time to try these. It must be an incompatibility issue with my aapt or smali/baksmali or something. It's driving me nuts. Framework-res.apk is the only one to give me that error. Regarding the keyboard, what I was referring to was after you recompile, sign it, and install it, the '&' and '<' symbols becoming '*&' and '<' respectively. I'm not sure why. I know that in res/values/strings.xml, there is a line showing all the symbols. I find the '&' and '<' but when I change them back to '&' and '<' it won't recompile. I don't really mind seeing &amp instead of &, but I'd like to be able to fix it. Thank you for taking your time. What system are you using ? I am doing this on a mac.
[G1 Android Development] pendo:
Yes, apktool does have some errors in decompiling LatinIME (similar to the problems that 1.3.2 has, but so far I've only caught 1.3.1 doing it to this apk). "amp" is code for the ampersand symbol and "lt" is for the less than symbol. (>) For some reason, apktool is decoding an already decoded entity reference. It sees "amp;" and it decodes it again, so you see "amp;amp;" If you were to compile it and then decompile it again, you'd get a 3rd instance. It only seems to do it with "amp" and "lt" if memory serves....

The files that you need to fix are in the /xml folder of the decoded apk. There's several in there that you need to check. What I ended up doing that works quite well was copying the /packages/inputmethods/LatinIME/java/res/xml/ directory from aosp and replaced the entire /xml folder. It compiles just fine, and you won't have any wrong keys.

By the way, I'm on a mac too and do pretty much all of my mod work in that (aosp stuff I tend to do in Ubuntu). Please feel free to pm me if you have any mac specific questions or if you need some more help with LatinIME :)
[G1 Android Development] HazzBazz:
Could someone try using apk tool's features on the Honeycomb music app? No access to a PC at this point.
[G1 Android Development] ihtfp69:
You have to deodex it first which is currently not possible. Plus once the source code is released, what's the point? You will have the original source code.
[G1 Android Development] Droidzone:
Odexing

Is it possible to odex a deodexed file using the apk and the dalvik-cache?
[G1 Android Development] Playon90:
It may be a super dumb question as I can guess the answer is anywhere and I just can't find...

my question is.

Once I decopilled the apk... can I edit the the resoures.arsc

and the .smali

and how.?

Thanks and sorry for bothering
[G1 Android Development] tommytomatoe:
After you decompile the apk, resources.arsc gets put into the Res directory. Look for folders in there that are not normally in Res like values. The XML in these folders are decoded and you can edit them. The smali files that come from classes.dex are decoded into a folder called smali. The .smali files are also editable and human readable, much like the xml. After you make edits you can build and the classes.dex will recompile and the correct folders will go back into Res and resources.asrc.

Not to be rude my friend but I recommend doing a little reading before diving in. It will be nice to have some basic knowledge and know-how. That's what I did and it really helps. I hope that clears it up for you. Have a lovely weekend.

T
[G1 Android Development] Playon90:
Sorry my bad. and Thanks for the help. The first apk I tried to decopile an apk the values folder didn't appear. maybe a apk fault. worked in the other one through (even if it only has a txt arquive in it).

and yes. I'm trying to read and learn all this stuff and google isn't being a good friend. That's why I asked here ... something I didn't find anywhere.

Thanks again for your help

have a good weekend
[G1 Android Development] he_stheone64:
I know exactly what you are talking about...
[G1 Android Development] fboldog:
honeycomb support

Hey,

I made two patches for honeycomb decompile.

One for apktool:

https:||github.com/fboldog/brut.apktool/commit/1b6d63cb355d4a36274f5edf0383a2c4e6e0f868

this patch allows decompile the honeycomb resources (tested with youtube, gmail, google bodies, market, movie studio)

One for dexlib:

http:||code.google.com/p/smali/issues/detail?id=58

this patch allows decompile honeycomb dex and odex files

The dexlib patch will be ported into apktool.

WARNING:

I don't guarantee any successful recompile and perfect decompile (we only use this apps for analyzing)
[G1 Android Development] dmmh:
PHP / Java / apktool help pls

hi peeps.

this message is not a call for help to brutt.all, but maybe someone with advanced PHP/ Java/ *nix knowledge could help me out (I know, OSx isn't *nix, sue me :p).

I am trying to interface with apktool via PHP.

It's more or less working, but I cant get any further and it's driving me nuts.

I'm running a local Apache server on OSx.

Since /usr/local/bin isn't inside my PATH, but /usr/bin/ is, I just bunged apktool, aapt and apktool.jar in /usr/bin/, for simplicity's sake.

When I open the terminal and type 'apktool', eveything responds as expected.

I had to override the default JDK version called on OSx from 1.5.0.x to 1.6.0.x though, which is what apktool needs, as of late.

Now, when I execute the following in PHP:

(almost) everything works; apktool loads, finds the apktool.jar file and from there it goes horribly wrong again, as the jar file invokes the wrong version of Java (all over again). I have confirmed the version called is 1.5.0.x.

This strikes me as odd, since the system defaults to JDK 1.6.0.x.

PHP accesses the sh shell, not the bash shell, but if I do java -version manually both shells return JDK 1.6.0.x, not 1.5.0.x, which is returned via PHP... wtf?

Any help from some nix or some osx guru would be appreciated!
[G1 Android Development] pendo:
I'm far from an expert and truthfully, don't know squat about PHP, but I thought I'd offer that I'm on a mac and use apktool all the time. Why is the default java version on your machine 1.5? Mine is 1.6 (has been for a while), so I never really had to worry about 1.5. Also, I'm pretty sure usr/local/bin was in my PATH from the get-go....did you remove it from your PATH?---I wouldn't think it would be a problem where you have it though.
[G1 Android Development] dmmh:
hello :)

thanks for the reply man.

Youre right, I guess I was kind of confusing :)

/usr/local/bin/ is in my path, but it's not in PHP's PATH.

Which is fine, if the files are in a PATH that PHP can access, which includes /usr/bin/

I dont know why the default Java was set as 1.6, maybe it's cause im still not on Leopard (and cant move to it either (hackintosh)) and it defaults to JDK 1.5.

got that fixed though: the system now defaults to 1.6, but Im guessing something is still wrong with that. Are these settings profile related?
[G1 Android Development] pendo:
Sorry friend, I'm afraid I won't be of much help to you. I've had Snow Leopard since the start of my android interests (last April), and I'm still quite new to most of this. This same time last year I didn't even know what PATH meant, lol.

Hopefully someone else will chime in here for you, but if not....you might consider setting up ubuntu for this.
[G1 Android Development] dmmh:
I hear ya, Im not on OSx for long myself...

But I will get it fixed :)
[G1 Android Development] tommytomatoe:
Dane, Pendo, fern, rest of gang,

Can you one of you guys me out? Someone asked me to mod the Htc Task Widget. It's an addtional optional widget for Sense. It installs into data/app/ and is called com.htc.rosiewidgets.task.apk. I don't know if any of you have seen it. Well, I do apktool and make my necessary edits. I recompile. Replace modded files. And here is where it gets hairy.

Attempt#1. I decide to push back into system/app/ to avoid signing the apk (originally it was in data/app/). I push it. Nothing happens. It doesn't show in my widgets list. I flash it in an update.zip. Same thing. Funny thing is, I can't remove in adb shell using "rm system/app/com.htc.rosiewidgets.task.apk". So I use root explorer and delete it from there. Back to ground zero.

Attempt#2. I decide to sign it. It is signed and verified. Great. So I install it. I get this error: "Failure [INSTALL_FAILED_SHARED_USER_INCOMPATIBLE]". I understand that HTC probably coded it to use a shared uid or something like that. It is one of their widgets. I go into AndroidManifest.xml and remove the android.uid line. Rebuild using apktool. Re-sign with my key. Once again, verified. I'm feeling good now. I use adb install to install it. It does its thing. Thirty seconds later, SUCCESS! Woot Woot...but no. I go into the widget selection and it is not there. The weird thing, the "Get More HTC Widgets Menu" sees it as "Installed".

Okay gang, where should I go next? Thanks for anything you can help me with. This guy asked me to this widget a month ago and I am now getting around to it. He told me no one was able to get and I didn't believe him. hehe. Maybe he's right.

T
[G1 Android Development] ihtfp69:
Do not change the manifest and do not re-sign the package and do not mess with the meta-inf folder. After you make your changes, put the changed files back into the original apk minus those ones you should not change. You must use the original signature from HTC or you must re-resign nearly the entire rom.
[G1 Android Development] tommytomatoe:
Yeah. That I realized. That's what I did with attempt 1. This one must require a special HTC key or something.
[G1 Android Development] Br1cK'd:
Brut.all, thank you for this tool. I'm a very jr. chef, and I was having all kinds of problems editing styles.xml and recompiling a working version. Spent a little while this morning getting apktool setup, and searching the thread, FAQ, Wiki, and issues for answers to my questions, which you seem to have provided in previous support, which I must say, your level of support for this is amazing. Hitting your thanks button, and the next donation I get, I'll split it with ya. Thx again.

Edited, out of thanks for the time being, I'll pop over and get ya later on today.
[G1 Android Development] dmmh:
Got it fixed...daaaaamn what was Apple thinking when they implemented Java for OSX?

Some people should get fired for that ****!

Fixed it by forcing/ pointing /usr/bin/java to the contents of the 1.6.0.jdk contents, sort of :-)

Decompiling works perfect for me now! Thanks brut.all!
[G1 Android Development] punkweakling:
whoops nevermind
[G1 Android Development] Brut.all:
Apktool Demo 2 - Smali improvements
[G1 Android Development] myn:
Nice :)

Any chance you can add some automated apk signing to it?

That is the BIGGEST PITA.

Or perhaps there already is a really really simple solution to this already?
[G1 Android Development] olearyp:
`jarsigner' from the Java SDK is the easiest way, though `signapk' included with the platform (you can grab just that part from AOSP GitWeb) is useful if you wish to use the testkeys in raw form. I've converted both the regular testkeys and the platform keys to jarsigner-compatible keystores if you prefer. The platform keys are in the GUSTO GitHub (see link in sig); PM if you want the generic testkeys and I'll put them up somewhere.
[G1 Android Development] canadiancow:
Looks awesome. Hopefully this will lead to some improvements to brut.googlemaps, since I'll finally be able to understand wtf is going on in all that code :p
[G1 Android Development] olearyp:
*/me falls off chair*

Is the debugger support specific to NetBeans? (Just curious, as I doubt I'll be mucking about in smali code much if at all.)
[G1 Android Development] btdownloads7:
Thanks, this is a great tool! I have a couple of problems, though, and was wondering if it could be a problem with apktool, or if I'm missing something. I successfully used this tool to modify several widgets (using version 0.92 on Ubuntu Karmic). However, there's on that gives mr problems -- TouchDown Exchange client. You can freely download their 5-day trial here:

http://tinyurl.com/tdbetadroid

First of all, trying do decompile it and recompile without making any changes, it threw an error in one of the XML files:

..td/res/values/strings.xml:957: error: Bad character in \u unicode escape sequence (in e.g.: domain\userid, userid, userid@mycompany.com)

I figured out that the string value wasn't escaped properly, so I manually changes the string "e.g.: domain\userid, userid, userid@mycompany.com" to "e.g.: domain\\userid, userid, userid@mycompany.com", and it started compiling without errors, but shouldn't that string been corrected automatically during the decompiling?

But after I install the recompiled app, it launches, but basically has no functionality (try going into the calendar and adding an event, even before you set up any settings). Any idea why that happens?
[G1 Android Development] Brut.all:
Not a bad idea, then I will be able to add build-sign-install-run combo command :-)

BTW, I always wondered why people use tools like SingApk, if signing is just a single line command (and SignApk is too)?

Yeah, me too... :-D

No. As you can see, I use DDMS, which is default method of debugging Android apps and it uses standard JPDA API.

Unfortunately it is not possible to run debugging by CTRL+F5 or such. I think we must create IDE plugin to do it :-/

It should. Thanks for info and a link to app :-)

I will look into it.

Unfortunately we have no documentation on how such tool should work, it is based on empirical experiences only, so there are many special cases, where it fail. I must fix them one by one.
[G1 Android Development] btdownloads7:
One other really weird thing with TouchDown, maybe it'll help you diagnose what's going on there. I tried manually hex editing the widget_calendar.xml file to change the text color to white (without decomping the APK, just unpack, mod the XML, repack, then re-sign). There are 12 lines of text that are programmed into the widget -- 4 events, 1st line is subject, 2nd line is time, 3rd line is location. I changed the text color to white on all the lines, and the 2nd and 3rd line for each event do show up in white, but the subject line stays black, even though it is set to the same color value as the rest of the lines. Is that weird or what?
[G1 Android Development] olearyp:
The <signjar /> Ant task has become a good friend. :) I guess I don't understand the comment. You have to use a tool to sign since the package has to be signed. Of course it's smart to automate that step in a build process if possible and secure to do so. In the case of testkeys, no security is implied, so it's all good--the deploy process for GUSTO releases is fully automated.

Ahh, I learn something new every day! I was wondering how exactly you were managing to step through comments, and was thinking it may have involved animal sacrifice.
[G1 Android Development] rac2030:
WTF... ;-)

This just looks damn impressive.
[G1 Android Development] Brut.all:
I guess I don't know something about signing Android apps ;-D

I mean jarsigner is a standard tool for signing jar files and it is just a one-line command, so I don't understand, why do people use and appreciate SingApk tool? I always use jarsigner to sign my apks and it just works.

:-D

I didn't really know, how debuggers or this JPDA works, but I knew, that it is possible to manually attach debugger to Android app:

http://developer.android.com/intl/de/guide/developing/debug-tasks.html#ide-debug-port

Also I guessed, that it would be too complicated, if IDE would parse Java code during debugging session and make some decisions based on it. IDE just gets some simple instructions from debugger, like: "I'm at line 66 of file xxx.java now" or "There is a variable named foo of type integer at memory adress #123456" and it does not check, whether these instructions makes any sense or not ("You are at line which is empty? WTF?"). Debugger creates these instructions using debugging symbols which are written in a bytecode and are accessible and editable in smali code.

So... if you'll join these facts, you will find, that it should possible to inject faked debugging symbols into smali code and no one will care about it. This is how apktool works :-)