[q] syntax error - Android Software/Hacking General [Developers Only]

I've searched, and searched, and searched some more.
I'm trying to create an update zip, but I keep getting this error:
E:Syntax error in update script
I'm trying to flash a com.htc.resources.apk that I modifies because I lose my ability to sign in gapps and I lose all my contacts when I push it. My update-script is in /META-INF/com/google/android. I edited it with notepad
THIS IS MY SCRIPT:
show_progress 0.1 0
copy_dir PACKAGE:system SYSTEM:
show_progress 0.1 10
What am I doing wrong?

YoungSinema said:
I edited it with notepad
Click to expand...
Click to collapse
I suspect this is your problem. Windows uses a different indicator for the end-of-line (EOL) than UNIX/Linux/Android.
Specifically, Windows uses a Carriage Return (CR) followed by a Line Feed (LF) whereas UNIX(ish) uses just a LF. The CR is seen by the UNIX system as just part of the command. But, one it doesn't know how to process.
I'm guessing you don't have CYGWIN or the like handy. Nor do you have a Linux system. So, the easiest solution would be to use a text editor that knows the difference. Hmm. Let me check something...
As I suspected, it looks like my favorite text editor can handle it. Notepad++. Google can find it for you. The setting is in Settings->Preferences->New Document/Default Directory->Format.
However, if you use Notepad++ for anything else, make sure you use the appropriate setting. Many windows programs will get very confused with UNIX EOLs. If the file is correct, it should appear to be smashed into one line when you open it with Notepad.
Oh yeah, I think WordPad might be able to cope. Not sure.

GinoAMelone said:
I suspect this is your problem. Windows uses a different indicator for the end-of-line (EOL) than UNIX/Linux/Android.
Specifically, Windows uses a Carriage Return (CR) followed by a Line Feed (LF) whereas UNIX(ish) uses just a LF. The CR is seen by the UNIX system as just part of the command. But, one it doesn't know how to process.
I'm guessing you don't have CYGWIN or the like handy. Nor do you have a Linux system. So, the easiest solution would be to use a text editor that knows the difference. Hmm. Let me check something...
As I suspected, it looks like my favorite text editor can handle it. Notepad++. Google can find it for you. The setting is in Settings->Preferences->New Document/Default Directory->Format.
However, if you use Notepad++ for anything else, make sure you use the appropriate setting. Many windows programs will get very confused with UNIX EOLs. If the file is correct, it should appear to be smashed into one line when you open it with Notepad.
Oh yeah, I think WordPad might be able to cope. Not sure.
Click to expand...
Click to collapse
Notepad++ works perfectly. Thanks. Also, I was able to take a theme that I download from someone else and make the necessary changes and flash it. Thanks for your help.

Related

AOSP lockscreen in sprint builds... ideas

I dabble in some programming, taking it in college now, but have little experience with linux and the like, so I don't know where to go from here. I found the files, I think, to modify so that the AOSP lockscreen will work. Found keyguard xml files in \system\framework\framework-res.apk\res\layout. Pretty sure these are the right files, as the images for the sliders is in this apk as well. And I know from a logcat that keyguard is what it's opening for the lockscreen. Only problem is, can't seem to view or edit these xml's in a readable format... tried three different editors. About to reboot into linux and try it there, maybe I'll have better luck. But thought I would ask here where there are people FAR more knowledgeable than I.
danaff37 said:
I dabble in some programming, taking it in college now, but have little experience with linux and the like, so I don't know where to go from here. I found the files, I think, to modify so that the AOSP lockscreen will work. Found keyguard xml files in \system\framework\framework-res.apk\res\layout. Pretty sure these are the right files, as the images for the sliders is in this apk as well. And I know from a logcat that keyguard is what it's opening for the lockscreen. Only problem is, can't seem to view or edit these xml's in a readable format... tried three different editors. About to reboot into linux and try it there, maybe I'll have better luck. But thought I would ask here where there are people FAR more knowledgeable than I.
Click to expand...
Click to collapse
They are in a binary format. I opened them in dreamweaver, and it still wasn't fully readable/able to be edited. you can use this to decode them to readable format, but I have NO CLUE how to get them back.
http://forum.xda-developers.com/showthread.php?t=514412
regaw_leinad said:
They are in a binary format. I opened them in dreamweaver, and it still wasn't fully readable/able to be edited. you can use this to decode them to readable format, but I have NO CLUE how to get them back.
http://forum.xda-developers.com/showthread.php?t=514412
Click to expand...
Click to collapse
Use the AXMLPrinter2.jar to convert the XML files to a Text Readable format. Unfortunately, to modify the files, you need to use a Hex Editor to do any updates. I havn't seen any utilities that will read/write the binary XMLs, just read.
-Daryel
I haven't had the time to look into this yet, but... Since the lock screen works fine in Darch's AOSP build, could it just be a matter of switching out the xmls?
Just an idea.
thematrixkid17 said:
I haven't had the time to look into this yet, but... Since the lock screen works fine in Darch's AOSP build, could it just be a matter of switching out the xmls?
Just an idea.
Click to expand...
Click to collapse
WOW, if that's all it takes, someone should try it lol
I mean, it couldn't be thaat easy, could it?
Doesn't it work on the Eris leak?
let me see what's there under the eris builds
Well I'm headed to class now, and have to study for a big big test tomorrow later, but I might find time, if someone doesn't beat me to it. Now I'm not all that familiar with the framework, but its just a brainstorm. And if the one in the eris leak works, then that xml probably has an even better chance playing well with the sprint build, I assume.
hey... you can view and edit the xml on the phone with root explorer after you extract them. Then just copy to pc to rezip
also, when rezipping an apk, using 7zip, is there a particular setting? compression level, method, etc.

Edit Lockscreen Text - Not Carrier Text - CM7

Apologies in advance if I am posting in the wrong section.
I've been talking to some people over on the CM forums about this and we haven't found an answer yet.
If you look in my screenshot, right below the alarm, my name is on my lockscreen. This was put here using an old setting on CyanogenMod 6.1.2 on my HTC Evo 4g. You did this on CM6 by going to Settings > Location & Security. Then there was a checkbox to "Show Custom Message". You then put in text!
Does anyone know which file stores this value on CM7/Android 2.3? I've pulled the eri.xml file from my phone and I can edit my carrier text but I have not been able to find my name. I like being able to edit that text and I wanted to update it to something new but the settings no longer exist under CM7. Thanks for looking!
I have found a ton of utils for editing carrier text but nothing for the text pointed to in the red arrow.
.
.
.
.
.
.
.
*bump*
re
Not the answer you are looking for here but wouldnt it be easier and less annoying and stressful to just flash back to the rom where you could change it, change it to what you want and then flash back ?
that is if i am understanding you correctly and your name shows up now of course with the new rom...
i would think if you changed your name to whatever you wanted then you could go back to the new rom and it would appear the way you want it.
I'm going to give that a try tomorrow. Not sure if it sticks through an upgrade or not but worth a try. Im just curious at this point what confit file it is. Wish there was a filemon or similar tool for Android. Although, if can dump all the files off the phone before and after I should be able to do comparisons....hrm. Project for tomorrow.
OK, finally took the time to work on this a little further.
I reflashed CM6, booted and confirmed there was no lockscreen text. Took a nandroid and copied off the system.img
I then put a lockscreen text in - used a custom phrase that would not be in any of the config files normally. Rebooted, took a nandroid and copied off this system.img.
Extracted both system.img files using unyaffs.
I did a binary and CRC comparison off all the files, no differences. So apparently this setting is stored somewhere else. Hrm......
AHA. Found the little bugger finally.
Had to pull the data.img and extract that. The setting is located in
/data/com.android.providers.settings/databases/settings.db
lock_screen_custom_msgTESTTEXT
lock_screen_show_custome_msg1
These are the two options that I found. So, now to see if I can safely edit that DB file and modify the text on CM7. I already have the text on my screen so the data fields are in the DB file already so I suspect I can just edit that file and then replace it on my phone.
Hm. Editing is no good. Blew away all my settings and I not longer can enable any lockscreen.
Hah. Got it! Using ADB works. Instructions:
adb shell
sqlite3 /data/data/com.android.providers.settings/databases/settings.db
.tables (you should see a secure table listed)
.header on
.mode column
select * from secure;
Now scroll through the results. Find the "lock_screen_custom_m" item under name. Note the ID number to the left. Write the ID number down.
update secure set value='your custom message here' where _ID=NN;
NN is the ID number you wrote down.
.quit
Reboot your phone.
There you go, just in case anyone else is interested.
jdostal said:
Hah. Got it! Using ADB works. Instructions:
adb shell
sqlite3 /data/data/com.android.providers.settings/databases/settings.db
.tables (you should see a secure table listed)
.header on
.mode column
select * from secure;
Now scroll through the results. Find the "lock_screen_custom_m" item under name. Note the ID number to the left. Write the ID number down.
update secure set value='your custom message here' where _ID=NN;
NN is the ID number you wrote down.
.quit
Reboot your phone.
There you go, just in case anyone else is interested.
Click to expand...
Click to collapse
Nice find!
I used a derivative of your method to reset the alarm notification on the GB lockscreen when the buggy POS alarm app G-Alarm left it there after removing all the alarms and uninstalling it.
That one is in system instead of secure, and it can be set to a blank string per http://developer.android.com/reference/android/provider/Settings.System.html#NEXT_ALARM_FORMATTED to clear it
Neat! Glad it could help someone out.
jdostal said:
Neat! Glad it could help someone out.
Click to expand...
Click to collapse
Yup, much appreciated! Also great to learn how to edit databases on Android.
Also, I didn't have a USB cable so I did it with the terminal editor. For convenience (i.e. having a real keyboard) I used Webkey for PC access to my phone and its built-in terminal editor to make the changes.
That sounds painful!
I don't know where I read the guide, but definitely use ADB. With ADB you can basically connect to the shell on your phone from your PC through a command prompt. Makes doing this sort of thing MUCH easier!
jdostal said:
That sounds painful!
I don't know where I read the guide, but definitely use ADB. With ADB you can basically connect to the shell on your phone from your PC through a command prompt. Makes doing this sort of thing MUCH easier!
Click to expand...
Click to collapse
Did you miss the part where I didn't have a USB cable?

Notepad Inserts Invisible Characters?

I'm trying to figure this strange behavior that has driven me nuts. I've attached two files that are part of a Igo GPS skin I edit. When I open place.ui and save any edits, notepad will insert invisible characters at the beginning of the file. You can confirm this by examining the file with a hex editor. If you edit common.ui with notepad, the same does not happen. The invisible characters inside place.ui causes my skin to fail to load. So I have to manually delete the invisible characters using a hex editor every time I edit the file. This happens on both my XP and Windows 7 systems.
Can anyone explain why this happen?
I don't care which text editor you think I should use. I just care about understanding why this one file gets the characters inserted into it. How is it special? Edit the file yourself and you'll see. Just add a space anywhere but the beginning of the file and save it.
Thanks!
Wow that is weird.
No idea as to why it happens but it always happens when I use notepad to edit files that were created using dreamweaver.
I have to use free version of HHD Software Hex Editor Neo to remove them.
I found your question as a search result to my own googling of "notepad inserts weird characters in beginning of file" while trying to find out what the actual issue is so I can let the guys who provide me templates made with dreamweaver someway to end the annoying situation.
ianian2 said:
No idea as to why it happens but it always happens when I use notepad to edit files that were created using dreamweaver.
I have to use free version of HHD Software Hex Editor Neo to remove them.
I found your question as a search result to my own googling of "notepad inserts weird characters in beginning of file" while trying to find out what the actual issue is so I can let the guys who provide me templates made with dreamweaver someway to end the annoying situation.
Click to expand...
Click to collapse
This is what is causing the problem: "é"
found in the word "azért" in the comments section. It seems to have been copied and pasted from another source and brought invisible characters with itself.

[Q] Edit Android .dat files

I wonder if anybody knows what program is needed to edit Android dat and idx files. Ideally I would prefer a Windows program but Android or Linux will also do.
Thanks.
I wish I knew too.
Trying to get older version of My Country when GameCiH wasn't prevented.
necromancy warning...
lug said:
I wonder if anybody knows what program is needed to edit Android dat and idx files. Ideally I would prefer a Windows program but Android or Linux will also do.
Thanks.
Click to expand...
Click to collapse
I was doing the same thing. I have found a rough solution. Hex Editor on Android will open and edit, with root. This is far from ideal. Hopefully someone will see these posts and provide a template or application for these specific file formats .dat and .idx.
I have seen individual apps for Windows that will hack apps, mostly games. I am not keen on downloading or using these. One- I don't do Windows, but can if absolutely necessary. Two- these may very well be virii...
I miss the good ole ResEdit days. I will check ResEdit & Resourcer when I get time and report back. This means getting the archives out. These apps used to have extensive file editing templates, mostly Mac.

Disable smileys/emoticons on HTC One X?

Okay, well today, I picked up a new HTC One X. First impressions were pretty good, and I have to say that as of yet, it's looking like it's a pretty good handset.
However; there's one thing about it that really bugs me. SMS messages apparently force you to use these utterly horrific smileys. I was never a fan of the old android icons that occasionally popped up, but these icons are just plain god-awful. Is there any way of disabling them?
(To be honest, I'd much prefer just to have your standard ASCII faces... Not to mention, if you happen to need to send a message that just happens to have the characters in that order, I'd rather not have badly made face icons appearing in the middle of it..)
bump. I can't believe htc require you to install a 3rd-party sms app in order to be able to get rid of emoticons. I'm a 40-yr old man, I don't want to see a crappy cartoon face in my text messages...
thanks for this nice q
3lliot said:
bump. I can't believe htc require you to install a 3rd-party sms app in order to be able to get rid of emoticons. I'm a 40-yr old man, I don't want to see a crappy cartoon face in my text messages...
Click to expand...
Click to collapse
My thoughts exactly... Not to mention, they're so badly designed that I spend more time working out what emotion they're actually supposed to convey, rather than reading the actual message...
Seems slightly out of place, too. The rest of the UI is nice and clean, fairly sleek looking - then you have these ridiculous cartoon faces slapped accross all of your texts..
I'm going to go ahead and bring this thread back from the dead.
Last time I tired to fix this by modifying my framework files and ended up soft-bricking my phone.
There's got to be a better way.
bump?
Untested Solution
EDIT: I looked more into it, and it gets pretty complicated. According to a StackExchange post I found (link in the attached .txt file), you can go through a process to retrieve the source code from the original .apk file BUT it requires the classes.dex file to be intact. That means you have to de-odex the Message+Nonprime.odex file, "re-dex" it into classes.dex, and add it to the Message+Nonprime.apk archive (can simply change the extension to .zip and add the file before continuing the linked steps).
After following all of those steps, I ended up with the source code and readable XML files. Unfortunately, trying to open them in Eclipse does not work, as I'm apparently missing key HTC resources (or I just don't know where the resources files should be pointing). I was hoping for the ability to just change the name across any necessary files, then repackage, but it doesn't seem to work like this.
I've also tried taking the original APK, adding the .dex file (created from the .odex -> files/folders -> dex process) inside, and signing the package (after deleting the META-INF folder containing HTC's signed information). I was hoping that signing the package after renaming it to Message2.0.apk would allow me to install it as a user application (I don't have root or the ability to change the bootloader to overwrite system applications, due to the 4.2.2 update) but the install always fails since "the application is already installed." If I knew how to modify the files within classes.dex properly, I'm sure I could rename the entire package and create a "New" application, but for now I've hit a brick wall. Hopefully if anyone reads this they can build on my failed attempts.
======================================================
======================================================
I stumbled on this (admittedly old) thread, and I don't know if anyone cares, but I've figured out what seems to be key in disabling smiley images from appearing. Below is the information of the phone I'm working with:
Phone Model Number: HTC One X
Android Version: 4.2.2
HTC Sense Version: 5.0
Software number: 5.18.502.1
HTC SDK API level: 5.41
Android uses "SmileyParser" to watch for certain key combinations and replace them with preset images. The theory is that by changing the strings SmilelyParser checks, it won't ever find a match, and they won't be replaced.
I found the Message application under /system/app/Message+Nonprime.apk. HTC's Message application utilizes Android's android.com.mms but has custom functionality/themes (I'm assuming)
Using ADB (Android SDK tool to browse filestructure), I used "adb pull [source] [local]" to copy the .apk and .odex files
I used "smali-#-#-#.jar" and "baksmali-#-#-#.jar" to convert the .odex file
The output of the tool gives a file structure with editable files. I navigated to com/android/mms/util/
In this folder, there are two key files: SmileyParser.smali, and SmileyParserOne.smali. I believe the "One" version may be modified to work with HTC One phones, but I'm not 100% sure (content looks similar)
I opened each file with Notepad++ and found "const string" references with the text version of an emoticon. The code seems to match those with "aput objects" but I don't know 100%
I modified each string (within the quotes) by just adding an 'x' to hopefully thwart the string match. Basically, the phone should wait until x or x is fully matched before replacing the smiley
I'll note again, I did the EXACT same process in both .smali files I mentioned, and I touched ABSOLUTELY NOTHING ELSE. There's no telling what you'll break if those don't compile correctly (which is why I also avoided adding a longer string, in case memory allocation issues cropped up)
I then repackaged the entire output I created into a new .odex file
Now, here's where things get tricky. I don't have a rooted phone, so I can't actually replace the .odex inside of the /system/app folder. I may work on testing on my phone (but I don't get a lot of time and really would not like to brick it), but I'm worried since I'm running a very recently updated Sense version (and there may not be reliable root processes, I have no idea).
If anyone has a rooted HTC One X (check above for the exact software version I have) that would like to try out the modified .odex file (apk is mostly UI/theme, .odex contains the actual programming logic) I am providing the .zip containing the apk and odex files. I've also tried installing the apk+odex with "adb install X/X.apk" but the application has a name buried in the structure (probably everywhere) and I have no idea how to rename it everywhere that's required.
If someone knows how to take a package and re-compile it with a new name, I could potentially re-install "Message 2.0" as a user app without any root privileges required. That's another option I'm looking into (since I'd really rather not root and potentially lose my stored data).
The same problem is still occurring in 2018. I would try your solution, but it's outdated. I'll have to dive in and edit the files myself if a solution isn't found. Although, in that case, I would probably match something further from the x, preferably with 2 bytes because as you said, memory issues might pop up and I'm not sure just how far they went with this.

Categories

Resources