Question for developers - G1 Q&A, Help & Troubleshooting

Right away, forgive my ignorance on the subject, I'm sure I can spend 10-12 hours searching forums and figure it out or someone can take 2 min and just answer it.
Lets say one was to take an app from the market and unzip it into a folder to see what it's made out of. Let's also say that one has absolutely no clue about android, Linux or programming in general, just too much curiosity and a phone to play with. So that certain individual (and I will not admit that it was me, it was.... my friend) found .dex file inside and thought of editing it, nothing fancy, just replace some URLs with other URLs. Here the question: How would I (I mean... my friend) would edit .dex file? Notepad seems to do it but something tell me (I mean... my friend) that it's not the right way. How would I put that app back toghether into .apk format after I'm done with it (Agh, screw it, it's me, it's not my friend). I should also note that I'm not trying to do this for profit or trying to steal someone's app.
Any help is greatly appreciated

You my friend are a Grade A tard.
apk files are not unzipped.
Decompiled maybe?

topdnbass said:
You my friend are a Grade A tard.
apk files are not unzipped.
Decompiled maybe?
Click to expand...
Click to collapse
Whatever you would like to call it. If it make you happy, I "decompilied" apk file using WinRAR to get a number of files including above mentioned .dex file.
Now that we have that figured out, how do I edit .dex file and repack everything else into .apk?
Thanks

First off, yes you can open the .apk file and see the other files but the files for the actual app are compiled. They arent editable. You would need the source to edit the app in any way.
As to the .dex file if you can open it with a text editor and change stuff all you are likely to do is break the app. As for putting it back together and getting it to install, good luck. You will probably need to get it resigned or something.
If you are wanting to learn how to make apps for android you should download the SDK. I believe there is a tutorial with some example apps that you can make out there somewhere also.

Dharkaron said:
First off, yes you can open the .apk file and see the other files but the files for the actual app are compiled. They arent editable. You would need the source to edit the app in any way.
As to the .dex file if you can open it with a text editor and change stuff all you are likely to do is break the app. As for putting it back together and getting it to install, good luck. You will probably need to get it resigned or something.
If you are wanting to learn how to make apps for android you should download the SDK. I believe there is a tutorial with some example apps that you can make out there somewhere also.
Click to expand...
Click to collapse
Agh, now we are getting somewhere.
Just for the record: I do not want to make apps, I'd rather leave it to pros and pay few bucks for working app that has no bugs.
The app I am referring too is StreamFusion which is a streaming audio player. Initial install puts about 30 preloaded stations in the playlist, none of which are of any interest to me. I unzipped apk and found this .dex file (resources.dex? not at home, can't check) which contained URLs for default-loaded streams. All I want to do is replace them with URLs of my own so I don't have to search shoutcast,add my stations and delete defaults everytime I decide to wipe my phone. Sounds like such a simple task, yet there's no clear documentation on how to do something like that (at least for the non-dev crowd).
With that said, I don't want to change the way StreamFusion, they do give you an option to remove defaults manually (one by one!) and they do give you an option to add your own stations in the playlist. It just takes too long and I've done it a few too many times already.
I'll keep playing with it, let me know if anyone for sure knows how to do it, otherwise I'll report when I figure it out or when I get tired of it.

Sorry for being rude earlier, i was in a bad mood
If you mean StreamFurious all you need to do is long press the radio station and hit delete

topdnbass said:
You my friend are a Grade A tard.
apk files are not unzipped.
Decompiled maybe?
Click to expand...
Click to collapse
Have you actually tried renaming an .apk file to .zip and opening it? In short, apk is just like a jar. They're just zip files with specific metadata requirements.
“Always keep your words soft and sweet, just in case you have to eat them.” -Andy Rooney

borodin1 said:
edit .dex file? Notepad seems to do it but something tell me (I mean... my friend) that it's not the right way.
Click to expand...
Click to collapse
when in doubt .. HEX .. hex editing of a file can maintain its purest essence and prevent it from crashing .. provided of course that you edit the right parts .. i've done this thousands of times in computer games .. change one little thing and POOF! your scrawny little piss-ant becomes mighty hercules and you can slay the dragon - LOL - ok .. so maybe not so korny

borodin1 said:
With that said, I don't want to change the way StreamFusion, they do give you an option to remove defaults manually (one by one!) and they do give you an option to add your own stations in the playlist. It just takes too long and I've done it a few too many times already.
Click to expand...
Click to collapse
The defaults that are hard-coded into the apk are loaded on first run into a sqlite3 database. Sure you could edit the hard-coded defaults, but this would be an unclean solution. A better solution would be to backup the sqlite3 database to your computer and restore it with adb whenever you reinstall. You can also easily edit the database conveniently on your pc as well.
The location of the db is /data/data/com.streamfurious.android.free/databases/streamfurious.db
By the way, the SF defaults already include KQED, BBC WS and TWiT. What more could anyone possibly need

You can decompile apk class files from the dex file.
http://zeaster.blogspot.com/2007/11/how-to-decompile-dex-file-on-android_28.html
As for repacking it after the edit.....check this out this might help...
http://forum.xda-developers.com/showthread.php?t=503007
or ask strazzere

Related

HTC Weather, problem & fix

I thought I would add this here unless anyone else runs into the same problem. I broke my HTC Weather yesterday while trying to upload local cities into it. I am running the Dec 03 release of HyperDragon, but HTC Weather seems to be the same (at least in terms of files to edit) across different platforms.
After adding my local city, and uploading it back to the phone when I went into the weather tab to add a new city, I was unable to search for any cities. In fact the search screen contained no entries at all. Essentially, I corrupted the xml file, and the phone was unable to read it.
How I broke it:
Be careful what you edit with. I just opened the file with word pad in Vista to copy my new city information, but the xml file and word pad don't like each other. I found that the tilde ( ` ) <--- that character appearing over letters was unsupported in word pad. The xml file was unable to then read it. It saw it as corrupted data.
To fix it:
I just deleted the offending cities with tilde's in them. I didn't need them anyways. However, one could also just edit the file with a better program and re-upload it to the phone. Once I fixed the file, HTC Weather saw my new cities and was more than happy to read them.
Maybe someone else already went over this. I don't know. But I know I searched on the forum for quite some time without finding out what I did wrong.
AT&T tilt running Hyperdragon
The first mistake was editing an XML file with wordpad. Try using Komodo next time. Always use the proper software for certain editing functions.
Heres a link to the Freeware Komodo XML Editor.
http://community.activestate.com/products/Komodo
didnt I say that
SpiritOne said:
I thought I would add this here unless anyone else runs into the same problem. I broke my HTC Weather yesterday while trying to upload local cities into it. I am running the Dec 03 release of HyperDragon, but HTC Weather seems to be the same (at least in terms of files to edit) across different platforms.
After adding my local city, and uploading it back to the phone when I went into the weather tab to add a new city, I was unable to search for any cities. In fact the search screen contained no entries at all. Essentially, I corrupted the xml file, and the phone was unable to read it.
How I broke it:
Be careful what you edit with. I just opened the file with word pad in Vista to copy my new city information, but the xml file and word pad don't like each other. I found that the tilde ( ` ) <--- that character appearing over letters was unsupported in word pad. The xml file was unable to then read it. It saw it as corrupted data.
To fix it:
I just deleted the offending cities with tilde's in them. I didn't need them anyways. However, one could also just edit the file with a better program and re-upload it to the phone. Once I fixed the file, HTC Weather saw my new cities and was more than happy to read them.
Maybe someone else already went over this. I don't know. But I know I searched on the forum for quite some time without finding out what I did wrong.
AT&T tilt running Hyperdragon
Click to expand...
Click to collapse
Next time use notepad that is what i use...also the XML file is in my download section go there and download it open it in notepad and edit then move it into the windows folder...u should be good to go..
How did you manage to get adding cities to WORK?
I followed the instructions that have been posted around, but the URL fragment is NOT as displayed in those posts anymore on www.accuweather.com.
Going to htc.accuweather.com from my Kaiser gets me something that looks SOMEWHAT similar, but its not the same - if I try to use the same format that other US cities are in for mine, I can locate it in the list but it won't update.
Any help?
Genesis3 said:
How did you manage to get adding cities to WORK?
I followed the instructions that have been posted around, but the URL fragment is NOT as displayed in those posts anymore on www.accuweather.com.
Going to htc.accuweather.com from my Kaiser gets me something that looks SOMEWHAT similar, but its not the same - if I try to use the same format that other US cities are in for mine, I can locate it in the list but it won't update.
Any help?
Click to expand...
Click to collapse
I am not sure what you are asking...I just added my city like MOD Scotchua said to do and it worked...
http://forum.xda-developers.com/showpost.php?p=2644237&postcount=2366
Aha - I screwed up. Its working now
Spoke too soon..... it KINDA works.
The currnet Manila 2D executable will go back to the top screen (the home page) if you hit the END button twice. It also will mark an incoming SMS "read" if you sit on it on the top page for a few seconds.
The patched one does neither. It will not go back to home unless you navigate there, and SMS do not get marked read.
Is the patch involved (e.g. could I go in with a hex editor and make a change to the CURRENT Manila executable?)
Update to THAT....
I took a quick look at the executables and found the change, with the different URLs. However, it appears the new one is longer than the old, which means that a quick "patch in place" is unlikely to work (I have no idea what's AFTER that block of data - and it ain't zeros, and IS apparent UTF-8 text - so I'm likely to scramble something doing a quick overwrite.)
This in turn implies that you need a way to disassemble the exe file and replace the data, then reassemble it (e.g. to assembler, at least) assuming you don't have source.
So..... anyone have a tool for this or is this a case of "have lots of fun playing with something that can disassemble it, find a clean place in the data segment to put the new reference, and fix it that way" sort of game?
SpiritOne said:
didnt I say that
Click to expand...
Click to collapse
yep... just rubbing it in some more
I wouldn't use notepad either. I'd rather not get into a long discussion about editing xml files with notepad either
An XML editor is definitely the way to go.
Yet another update....
What's with the app here? I patched it with a string that fits using a hex editor.
What I wind up with refuses to run. Are these apps cryptographically signed?
Answer: Yep, and once modified, the signature is no good. I don't see anything in Advanced Config that can turn that protection off either; you can disable the requirement that CABs be signed, but I don't see where you can disable the requirement that APPLICATIONS be signed. My security policy settings are such that all security is off, but attempting to run the patched executable by hand elicits a complaint about the signature being invalid. I presume that a MISSING signature would be ok, but a CORRUPT one is going to get complained about - and I have no means to fix that.
Yet more....
I have found the code-signing tools after rooting around and re-signed the application.
It still fails to work; it appears there is a SECOND call to an HTC web site in the current Manila2D code which is NOT in the other patched file.
That one goes to: http://weather.manila1.htc.com/widget/htc/forecast-data_v3.asp?locCode=
DNS shows the address is a CNAME to htc.accuweather.com, and the worse news is that the replacement string that goes in the other place doesn't fit in there - its one byte too long.
It also looks like THIS is the one being called for updates, because changing the other, direct call to the htc.accuweather.com link doesn't change anything - the codes in the file that refer to places accuweather handles still work, but those that refer to other places do not.
Any ideas?
Final Fix - Read
Ok, here's what I've accomplished.
I patched the Manila2D.exe (the CURRENT copy from HyperDragon and others) and have re-signed the code (with a self-signed cert)
I also grabbed the php script and set it up on a VERY short domain name I registered this afternoon, htcwx.org - it exists ONLY for this purpose and is NOT a generic HTC web site.
I have modified the script as necessary, and the firmware as necessary. The replacement Manila2D.exe file is attached. To implement this simply replace the Manila2D.exe in your \Windows directory on the device with the one in this ZIP file. That's it; you can then add city codes at will in the weather file list and they will work.
The previously-posted version of Manila2D.exe has a couple of bugs that I consider show-stoppers, and patching the current version necessitated having a shorter URL as one of the places required to be patched would not allow the "not2advanced" url to fit.
Note that this weather reflector is being run by me, is OPEN and will remain indefinitely; I have a very high-bandwidth connection and expect no interruption in that service. Feel free to use it.
I now have WORKING HTC weather in Manila for virtually anywhere.... and you can too without the restrictions that existed in the previous patched copy (no return to home screen with the END key, and no SMS message marking)
This script "portal" should also work with any other patched HTC Home or HTC Manila applications; the complete url is http://htcwx.org/wx.php?
Note that there is NO general content on that web site.
Enjoy!
PS: As of this instant the .ORG TLD nameservers haven't picked the domain up yet from my registrar. That's abnormal; I see it on my infrastructure but not globally. It should be globally visible by morning.
There's just one thing left to say:
Thank you!
I've been fiddling with this for quite some time, and once I've found this thread everything worked as advertised!!
Happy new year!!
Glad it works for you! Happy New Year to you as well.
Hi Genesis3,
I have installed yesterday Josh's v15 M2D Plain 3G ROM and would like to customize the Weather and add my location.
Your Manila2D.exe is 1.1 Mo where the Manila2D.exe included in this ROM is only 410 KB .... Do you think I can change the original by your's ?
Thanks
That copy is PROBABLY compressed. If it is, the strings can no longer be patched.
You need to talk to the chef and get the uncompressed EXE file - if he has it.
Packed manila2d.exe
I haven't seen anyone post about this but the compressed manila2d.exe that I have uses UPX it worked for me to both unpack and repack the file.
Look into the file for "$Info" if it say's packed with UPX the link above may work for you too. (about 350h char's in)
ENJOY!
Genesis3 said:
That copy is PROBABLY compressed. If it is, the strings can no longer be patched.
You need to talk to the chef and get the uncompressed EXE file - if he has it.
Click to expand...
Click to collapse
As with everything here YMMV, make backups and if you blow it up don't blame anyone but the operator.

Text Editor on Android...

... with a search feature. Does it exist?
I'm currently using Text Edit, but it's pretty horrible for large text files, and doesn't have searching. I use Vi sometimes, but that's just a pita.
Anyone know of a free text editor with search capabilities?
I gotta say, vi, though even more vim (the "enhanced" version) is probably one of the very best (if not ABSOLUTELY the best) text editors ever written. Yes, it does have a *VERY* steep learning curve, but when you really get to know it well, there is absolutely no faster or more powerful way of editing text files.
Yeah, I'm not a fan of Vi.
Does anyone know any other alternatives? Perhaps, is there a way to use nano?
Is there *ANY* other way to edit a text document aside from Text Edit and Vi??
documents to go?
quickoffice?
djind said:
documents to go?
quickoffice?
Click to expand...
Click to collapse
QuickOffice can only open/view files; it cannot edit at all. And Documents to Go is too expensive for my budget. (I only need .txt file editing anyway.)
I guess I should rephrase: Is there ANY other FREE way to edit a text document on the G1 aside from Text Edit and Vi?
Are the text editing options on the G1 really that limited?
Pick your favorite open source console text editor and compile it for arm.
lbcoder said:
Pick your favorite open source console text editor and compile it for arm.
Click to expand...
Click to collapse
How would I go about this? Any guides on here that explain this?
Yeah give me pico.
This task really isn't for newbs, but here's an idea of what is involved anyways:
http://android-tricks.blogspot.com/
I have done some searching, I cant find a text editor that I like. I would like one that can run with SU privileges so I can modify scripts I keep in /system/sd. If I need to I can remount it so that it would save, that wouldnt be a big deal, I would just like to not have to move them to my sdcard, edit, then move back.
I am also not familiar with linux so vi isnt for me if that would work, just looking for a decent alternative with a GUI if possible.
There used to be a cool app in the market called ptexteditor or something but its gone now
Somebody please compile nano... If I knew how to do it... I would... but I'm too noob for the instructions that were given a few posts back...
ES File explorer
For editing text files you could use ES File explorer. I found I was able to open, edit and save my userinit.sh and user.conf. This is quite enough for me!
Sure enough, it is not able to open /system/sd, but it's ok, because you can copy the files from the terminal. You could even make a simple script that would do it for you..
Until someone compiles nano or vim
I'm bringing this thread back from the dead simply because this thread is the first Google result from XDA for text editors, and the discussion here is the exact one that was going on in my head (around vi and nano). I eventually found 920 Text Editor, which has programmatic syntax highlighting, root mode, and is free:
https://play.google.com/store/apps/details?id=com.jecelyin.editor
Thanks,
Ben
also to be considered is this thread about 'nano' the terminal-based editor -- http://forum.xda-developers.com/showthread.php?t=552287

Is there a way to open .apk and find the code

Hi All,
i was wondering if there is a way to open a .apk file and see the coding for the app. Thanks in advance for your help all.
You mean like reverse engineering? It's a pretty fine line around here...
Not tryin to do anything bad or illegal..just wanted to see what an app code looks like...how its broken down....thats all
most apks arent just one thing. the apk acts like a zip file, containing potentially lots of files inside. you can use winrar to open them just fine.
thanks just tryin to learn what makes an app and how it works
jef8310 said:
thanks just tryin to learn what makes an app and how it works
Click to expand...
Click to collapse
http://developer.android.com/guide/developing/tools/index.html
thats where you should go then lol
Thanks B-man007...i will check that out
Just rename your .apk extension to .zip and unzip it. You will get to see some stuff there.
Stuff you can't see readily:
The manifest file can be viewed with some tools available on sourceforge (very easy). You can disassemble/reassemble the .dex file(s), but I warn you that this is a pain in the A. I have done it several times and cursed all the way through each time.
What are you trying to do?
Easy apk dissassembler.
The most easy way to dissassemble APK is using this app:
Is easy and intuitive.
http://code.google.com/p/easy-apk-dissassembler/
You have this thread too
http://forum.xda-developers.com/showthread.php?p=14049173
reverse engineering is how i learned to write my own programs for my ti-86 graphing calculator back in high school. seeing how/why things work inside an established program helped me figure out what i needed to make what i wanted. i wish app development was as easy as basic haha. of course, i say that with no knowledge of java or android programming. i plan on going to school starting next year to learn it though.

[MOD/CHEAT][Guide]How To Edit Fieldrunners HD for Money & Health

Hello everyone......if youre like me and just want to beat the crap out of a game that ticks you off sometimes then this is for you. This guide will explain how to edit the apk for fieldrunners hd. I will not supply or distribute the apk, so please do not ask.
First you will need the apk file you have purchased from android market. If you have an apk from amazon app store it will not work.
Start by changing the file extension from apk to .zip. Next, extract the contents of the file to a new folder on your desktop. (Folder can be named anything you like)
Open folder Assets>Data>HighResolution>Maps
Here you will find 4 folders....Cave, Crossroads, Drylands, Grasslands
Open the Folder for the level you wish to edit. (I will use grasslands as example for this guide)
Look for the files that have a ~map.mp3 extension. Open this file with a text editor like notepad. A few lines into the file will see this "startingHealth="20" startingResources="15". Change these values to anything you want them to be.
If you would like to modify the specs for the towers you can do this as well. I find it fun to make one weapon that just kills everything in one blow.
Open folder Assets>Data>HighResolution>Towers. Look for the tower you would like modify and open the file with a ~tower.mp3 extension in a text editor like notepad. Each tower will have one of these files for it. When opened look for <minDamage="129" maxDamage="129"> There will be a line like this for each level of tower, 1,2&3. Change he values to whatever you like, the higher the number the stronger the weapon.
Now that you have editied all maps and towers you want to it is time to button this up. Select all the files and folders you extracted from the zip file and create a new zip file. I use winzip with no compression. Name your new file whatever you like and save it to the desktop or a place you can find it. Now change the file extension of the new file from .zip to .apk. You will now need to sign the file, you will have to learn that in a different writeup. Once the file is signed it will install and you will see the changes in the game.
Good luck tinkering, do not post apk's here, and please act responsibly.
Could you please explain how to mod subway surfers for unlimited money ,they are found at many sites on net but i want how do they mod it
Sent from my GT-S6802 using Tapatalk 2

Adding smileys to whatsapp

Hi guys. This might be a long shot and not doable, but thought I'd enquire.
Is there a way to add my own smileys/images/gifs so that they're integrated with all the the default ones and can be added to text, rather than attaching from the gallery?
Thought I'd experiment. I just downloaded the latest apk for whatsapp , 'com.whatsapp-212158.apk' to my laptop, renamed it to com.whatsapp-212158.zip and opened it. Inside the zip folder are thousands of .png files, and all the smileys are 48 x 48. When I then extracted the contents of the zip folder to another folder, the smileys are in a sub folder called drawable-hdpi-v4. Could I simply resize and add my own .png files, rename the folder to com.whatsapp-212158.apk, and install? Would it work?
Even if it did, every time I wanted to add new smileys, I presume I'd always have to work with the apk and reinstall on the phone, or is there a whatsapp file already installed on the phone that could be edited? Only files I see on the phone are three different msgstore.db.crypt8 files in the whatsapp database folder.
Thanks.
PS, I'm not rooted and it just ocurred to me that I'm probably going to be told that I'll need to be rooted to access any editable whatsapp emoticon folder?
What will it give you? Others will not be able to see it I guess.
I don't know, you might be right. Why might they not see it?
Roman5 said:
I don't know, you might be right. Why might they not see it?
Click to expand...
Click to collapse
Because they have to do the same thing, for example if you change a (smile) (img15) and replace it with (wink) they will still receive it as a code (img15) and the application will transfer it to the original image .. a smile
vicino said:
Because they have to do the same thing, for example if you change a (smile) (img15) and replace it with (wink) they will still receive it as a code (img15) and the application will transfer it to the original image .. a smile
Click to expand...
Click to collapse
You're right. But I'm not intending to change existing smileys , my intention is to add new ones which will have a new name ending in .png.
eg, xxx.png. Even though recipients won't have it to use themselves, they should be able to see it I imagine?
Roman5 said:
You're right. But I'm not intending to change existing smileys , my intention is to add new ones which will have a new name ending in .png.
eg, xxx.png. Even though recipients won't have it to use themselves, they should be able to see it I imagine?
Click to expand...
Click to collapse
How can they see it if they don't have it?
When you send emoji using for example whatsapp you send a code not image and the application translate it.
Ah. In that case, I guess it won't work. Thanks for the help. :good:

Categories

Resources