Just An Application

September 14, 2011

Android Internals: Resources – Part Two: Resource Table Example

The majority of examples which follow are taken from the Resource Table which resulted from the creation of a vanilla Android application project in Eclipse using the ADT plugin.

Here are the generated files from that project.

1.0 AndroidManifest.xml

The contents of the generated file AndroidManifest.xml.


    <?xml version="1.0" encoding="utf-8"?>
    <manifest 
        xmlns:android="http://schemas.android.com/apk/res/android"
        package="xper.resources.pendragon"
        android:versionCode="1"
        android:versionName="1.0">

        <uses-sdk android:minSdkVersion="8" />

        <application 
            android:icon="@drawable/icon" 
            android:label="@string/app_name">

            <activity android:name=".PendragonActivity"
                  android:label="@string/app_name">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>

        </application>
    </manifest>

1.1 gen/xper/resources/pendragon/R.java

The contents of the generated file gen/xper/resources/pendragon/R.java.


    /* AUTO-GENERATED FILE.  DO NOT MODIFY.
     *
     * This class was automatically generated by the
     * aapt tool from the resource data it found.  It
     * should not be modified by hand.
     */

    package xper.resources.pendragon;

    public final class R {
        public static final class attr {
        }
        public static final class drawable {
            public static final int icon=0x7f020000;
        }
        public static final class layout {
            public static final int main=0x7f030000;
        }
        public static final class string {
            public static final int app_name=0x7f040001;
            public static final int hello=0x7f040000;
        }
    }

1.2 res/values/strings.xml

The contents of the generated file res/values/strings.xml.


    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <string name="hello">Hello World, PendragonActivity!</string>
        <string name="app_name">Pendragon</string>
    </resources>

1.3 resources.arsc

The result of running hexdump on the resources.arsc file extracted from the application .apk file.


    0000000 02 00 0c 00 64 04 00 00 01 00 00 00 01 00 1c 00
    0000010 d0 00 00 00 06 00 00 00 00 00 00 00 00 01 00 00
    0000020 34 00 00 00 00 00 00 00 00 00 00 00 1d 00 00 00
    0000030 3a 00 00 00 57 00 00 00 6d 00 00 00 8f 00 00 00
    0000040 1a 1a 72 65 73 2f 64 72 61 77 61 62 6c 65 2d 6c
    0000050 64 70 69 2f 69 63 6f 6e 2e 70 6e 67 00 1a 1a 72
    0000060 65 73 2f 64 72 61 77 61 62 6c 65 2d 6d 64 70 69
    0000070 2f 69 63 6f 6e 2e 70 6e 67 00 1a 1a 72 65 73 2f
    0000080 64 72 61 77 61 62 6c 65 2d 68 64 70 69 2f 69 63
    0000090 6f 6e 2e 70 6e 67 00 13 13 72 65 73 2f 6c 61 79
    00000a0 6f 75 74 2f 6d 61 69 6e 2e 78 6d 6c 00 1f 1f 48
    00000b0 65 6c 6c 6f 20 57 6f 72 6c 64 2c 20 50 65 6e 64
    00000c0 72 61 67 6f 6e 41 63 74 69 76 69 74 79 21 00 09
    00000d0 09 50 65 6e 64 72 61 67 6f 6e 00 00 00 02 1c 01
    00000e0 88 03 00 00 7f 00 00 00 78 00 70 00 65 00 72 00
    00000f0 2e 00 72 00 65 00 73 00 6f 00 75 00 72 00 63 00
    0000100 65 00 73 00 2e 00 70 00 65 00 6e 00 64 00 72 00
    0000110 61 00 67 00 6f 00 6e 00 00 00 00 00 00 00 00 00
    0000120 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    *
    00001e0 00 00 00 00 00 00 00 00 1c 01 00 00 04 00 00 00
    00001f0 6c 01 00 00 04 00 00 00 01 00 1c 00 50 00 00 00
    0000200 04 00 00 00 00 00 00 00 00 01 00 00 2c 00 00 00
    0000210 00 00 00 00 00 00 00 00 07 00 00 00 12 00 00 00
    0000220 1b 00 00 00 04 04 61 74 74 72 00 08 08 64 72 61
    0000230 77 61 62 6c 65 00 06 06 6c 61 79 6f 75 74 00 06
    0000240 06 73 74 72 69 6e 67 00 01 00 1c 00 50 00 00 00
    0000250 04 00 00 00 00 00 00 00 00 01 00 00 2c 00 00 00
    0000260 00 00 00 00 00 00 00 00 07 00 00 00 0e 00 00 00
    0000270 16 00 00 00 04 04 69 63 6f 6e 00 04 04 6d 61 69
    0000280 6e 00 05 05 68 65 6c 6c 6f 00 08 08 61 70 70 5f
    0000290 6e 61 6d 65 00 00 00 00 02 02 10 00 10 00 00 00
    00002a0 01 00 00 00 00 00 00 00 02 02 10 00 14 00 00 00
    00002b0 02 00 00 00 01 00 00 00 00 01 00 00 01 02 34 00
    00002c0 48 00 00 00 02 00 00 00 01 00 00 00 38 00 00 00
    00002d0 20 00 00 00 00 00 00 00 00 00 00 00 00 00 78 00
    00002e0 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00
    00002f0 00 00 00 00 08 00 00 00 00 00 00 00 08 00 00 03
    0000300 00 00 00 00 01 02 34 00 48 00 00 00 02 00 00 00
    0000310 01 00 00 00 38 00 00 00 20 00 00 00 00 00 00 00
    0000320 00 00 00 00 00 00 a0 00 00 00 00 00 00 00 00 00
    0000330 04 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00
    0000340 00 00 00 00 08 00 00 03 01 00 00 00 01 02 34 00
    0000350 48 00 00 00 02 00 00 00 01 00 00 00 38 00 00 00
    0000360 20 00 00 00 00 00 00 00 00 00 00 00 00 00 f0 00
    0000370 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00
    0000380 00 00 00 00 08 00 00 00 00 00 00 00 08 00 00 03
    0000390 02 00 00 00 02 02 10 00 14 00 00 00 03 00 00 00
    00003a0 01 00 00 00 00 00 00 00 01 02 34 00 48 00 00 00
    00003b0 03 00 00 00 01 00 00 00 38 00 00 00 20 00 00 00
    00003c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00003d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00003e0 08 00 00 00 01 00 00 00 08 00 00 03 03 00 00 00
    00003f0 02 02 10 00 18 00 00 00 04 00 00 00 02 00 00 00
    0000400 00 00 00 00 00 00 00 00 01 02 34 00 5c 00 00 00
    0000410 04 00 00 00 02 00 00 00 3c 00 00 00 20 00 00 00
    0000420 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    0000430 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    0000440 10 00 00 00 08 00 00 00 02 00 00 00 08 00 00 03
    0000450 04 00 00 00 08 00 00 00 03 00 00 00 08 00 00 03
    0000460 05 00 00 00                                    
    0000464

Copyright (c) 2011 By Simon Lewis. All Rights Reserved.

Advertisements

5 Comments »

  1. […] This is the annotated version of the StringPool chunk immediately following the Table chunk header from the example. […]

    Pingback by Android Internals: Resources – Part Four: The StringPool Chunk « Just An Application — September 15, 2011 @ 5:38 am

  2. […] This is an annotated version of the Package chunk header from the example. […]

    Pingback by Android Internals: Resources – Part Five: The Package Chunk « Just An Application — September 16, 2011 @ 6:29 am

  3. […] The Typespec chunk above defines the entries for the drawable Resources in the example Package. […]

    Pingback by Android Internals: Resources – Part Six: The Typespec Chunk « Just An Application — September 17, 2011 @ 5:57 am

  4. […] layout file that was automatically generated as part of the same project the Resource table example was taken […]

    Pingback by Android Internals: Binary XML – Part One Example « Just An Application — September 22, 2011 @ 7:01 am

  5. […] four Resouce identifiers generated as part of the Resource Table example here break down as […]

    Pingback by Android Internals: Resource Ids And Resource Lookup « Just An Application — January 22, 2013 @ 9:46 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: