No need to reinvent the wheel:
https://code.google.com/p/android-apktool/

Hope this helps
Yaron
On 07/11/2013 02:13 AM, giles ian wrote:
Hi Illyoung Choi,
*
*
*Is it possible for you to share the code for the entire thing. i.e. *
*
*
*1.Parsing*
*2. Modifying
*
On Tuesday, June 21, 2011 8:09:12 PM UTC-7, Illyoung Choi wrote:

    Hi All.

    Last day, I made a simple application for parsing an Android Resource
    File (*.arsc) and modifying resource strings.

    I think this thing might be a help for someone, so I'll share the
    structure of *.arsc that I understood.

    Since I could not spend many hours for this, my understanding is not
    perfect and might be slightly wrong.


    I patched string resource from *.apk.
    Simply extracted *.apk with 7zip and got the resources.arsc file.

    Below are the structure of *.arsc

    struct ANDROID_RESOURCE_HEADER
    {
    int signature; // 0x000c0002, I assume this is a signature
    int nImageLength; // total ARSC file size (bytes)
    int nUnknown1[2]; // still unknown (not important for modifying
    strings)
    int nStringBlockLength; // total StringBlock(see below) size
    int nStringCount; // total number of String Resources
    int nUnknown2[4]; // still unknown  (not important for modifying
    strings)
    }

    "struct ANDROID_RESOURCE_HEADER" is a header of ARSC file image.
    So simply you can read this header information from file.

    After this header, you will meet the StringBlock

    StringBlock has 2Sections
    {
    [String Offset]
    [String Data]
    }

    String Offset Section has Offset Values of Specific Strings from
    StringBlock Start Address.

    String Data Section has 2 Part

    String Data
    {
    [Length]
    [String]
    }

    Length part is 2byte. but, in AscII Mode, uses only 1byte.
    Before reading String, you must check whether it is "Unicode" or
    "AscII" format.

    in Unicode format, Length part will be used with 2bytes.
    normally it is "0x??, 0x00" (only if it is not longer than 256 bytes)

    in AscII format, Length part will be used with 1bytes. but, they also
    used second byte for mirroring.
    if string length has a value 7, you will meet "0x07, 0x07"

    So, I checked whether both bytes have same value to check string
    format.


    Lastly, actual string data will be after this length part with "Zero
    Terminal"
    in Unicode format, surely, Zero Terminal will be 2 byte of zero.



    Whenever you change the string of this ARSC file, you should
    recalculate these.
    Length Part of String Data
    String Offset of StringBlock
    nImageLength of Header
    nStringBlockLength of Header


    After doing these all.
    Simply, remove all JAR Signature (META-INF folder) from package.
    Re-Archive with Zip and rename with *.apk.
    Resign with your certificate by using "jarsigner" of JDK



    Thanks.

--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.




--
Yaron Reinharts
Smart Drive Applications
http://www.poncho.co.il/gateaway.php
https://market.android.com/details?id=com.poncho.gsm.gate.activities


--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to