You are on page 1of 17

ANDROID

December 8, 2011

VIRUS by FAST TRACK

VIRUS | Confidential

ANDROID
What is Android :

December 8, 2011

Android is a software stack[ i.e. Architecture of Android ] for mobile devices that includes an operating system, middleware, and key applications. The Android SDK provides the tools and libraries necessary to begin developing applications on the Android platform using the Java programming language.

Abbreviations :
SDK : Software Development Kit AVD : Android Virtual Device ADT : Android Development Tools NDK : Native Development Kit adb[ADB] : Android Debug Bridge DDMS : Dalvik Debug Monitor Server OHA : Open Handset Alliance .APK : Android Application Package

SDK : Software Development Kit


The Android software development kit (SDK) includes everything you need to start developing, testing, and debugging Android applications. Included in the SDK download are: The Android APIs : The core of the SDK is the Android API libraries that provide developer access to the Android stack. These are the same libraries used at Google to create native Android applications. Development Tools : To turn Android source code into executable Android applications, the SDK includes several development tools that let you compile and debug your applications. The Android Emulator : The Android Emulator is a fully interactive Android device emulator featuring several alternative skins. Using the emulator, you can see how your applications will look and behave on a real Android device. All Android applications run within the Dalvik VM so that the software emulator is an excellent environment in fact, as it is hardware-neutral, it provides a better independent test environment than any single hardware implementation. Full Documentation : The SDK includes extensive code-level reference information detailing exactly whats included in each package and class and how to use them. In addition to the code documentation, Androids reference documentation explains how to get started and gives detailed explanations of the fundamentals behind Android development. Sample Code : The Android SDK includes a selection of sample applications that demonstrate some of the possibilities available using Android, as well as simple programs that highlight how to use individual API features. Online Support : Despite its relative youth, Android has generated a vibrant developer com-munity. The Google Groups at http://code.google.com/android/groups are active forums of Android developers with regular input from the Android development team at Google. VIRUS | Confidential

ANDROID
AVD : Android Virtual Device

December 8, 2011

AVD is an emulator configuration that lets you model an actual device by defining hardware and software options to be emulated by the Android Emulator. OR An AVD is a device configuration for the Android emulator that allows you to model different configurations of Android-powered devices. Creating AVD : The easiest way to create an AVD is to use the graphical AVD Manager, which you launch from Eclipse by clicking Window > Android SDK and AVD Manager. You can also start the AVD Manager from the command line by calling the android tool in the tools directory of the Android SDK.

An AVD consists of: A hardware profile: Defines the hardware features of the virtual device. For example, you can define whether the device has a camera, whether it uses a physical QWERTY keyboard or a dialing pad, how much memory it has, and so on. A mapping to a system image: You can define what version of the Android platform will run on the virtual device. You can choose a version of the standard Android platform or the system image packaged with an SDK add-on. Other options: You can specify the emulator skin you want to use with the AVD, which lets you control the screen dimensions, appearance, and so on. You can also specify the emulated SD card to use with the AVD. A dedicated storage area on your development machine: the device's user data (installed applications, settings, and so on) and emulated SD card are stored in this area.

You can create as many AVDs as you need, based on the types of device you want to model. To thoroughly test your application, you should create an AVD for each general device configuration (for example, different screen sizes and platform versions) with which your application is compatible and test your application on each one.

Managing AVDs with AVD Manager


1. Creating an AVD 1. Hardware options The AVD Manager is an easy to use user interface to manage your AVD (Android Virtual Device) configurations. An AVD is a device configuration for the Android emulator that allows you to model different configurations of Android-powered devices. When you start the AVD Manager in Eclipse or run the android tool on the command line, you will see the AVD Manager as shown in figure 1:

VIRUS | Confidential

ANDROID

December 8, 2011

Figure 1. Screenshot of the AVD Manager. From the main screen, you can create, delete, repair and start AVDs as well as see the details of each AVD.

Creating an AVD
You can create as many AVDs as you would like to test on. It is recommended that you test your applications on all API levels higher than the target API level for your application. To create an AVD: 1. Start the AVD Manager: o In Eclipse: select Window > Android SDK and AVD Manager, or click the Android SDK and AVD Manager icon in the Eclipse toolbar. o In other IDEs: Navigate to your SDK's tools/ directory and execute the android tool with no arguments. 2. In the Virtual Devices panel, you'll see a list of existing AVDs. Click New to create a new AVD. The Create New AVD dialog appears.

VIRUS | Confidential

ANDROID

December 8, 2011

Figure 2. Screenshot of the Create AVD window 3. Fill in the details for the AVD. Give it a name, a platform target, an SD card size, and a skin (HVGA is default). You can also add specific hardware features of the emulated device by clicking the New... button and selecting the feature. For a list of hardware features, see Hardware options. Note: Be sure to define a target for your AVD that satisfies your application's Build Target (the AVD platform target must have an API Level equal to or greater than the API Level that your application compiles against). 4. Click Create AVD. Your AVD is now ready and you can either close the SDK and AVD Manager, create more AVDs, or launch an emulator with the AVD by selecting a device and clicking Start.

VIRUS | Confidential

ANDROID

December 8, 2011

Hardware options If you are creating a new AVD, you can specify the following hardware options for the AVD to emulate: Characteristic Device ram size Description The amount of physical RAM on the device, in megabytes. Default value is "96". Whether there is a touch screen or not on the device. Default value is "yes". Whether there is a trackball on the device. Default value is "yes". Whether the device has a QWERTY keyboard. Default value is "yes". Whether the device has DPad keys. Default value is "yes". Whether there is a GSM modem in the device. Default value is "yes". Whether the device has a camera. Default value is "no". Default value is "640". Property hw.ramSize

Touch-screen support Trackball support Keyboard support DPad support GSM modem support Camera support Maximum horizontal camera pixels Maximum Vertical camera pixels GPS support Battery support Accelerometer

hw.touchScreen

hw.trackBall

hw.keyboard

hw.dPad hw.gsmModem

hw.camera hw.camera.maxHorizontalP ixels hw.camera.maxVerticalPix els hw.gps hw.battery hw.accelerometer

Default value is "480".

Audio recording support Audio playback support SD Card support

Cache partition support

Whether there is a GPS in the device. Default value is "yes". Whether the device can run on a battery. Default value is "yes". Whether there is an accelerometer in the device. Default value is "yes". Whether the device can record audio. Default value is "yes". Whether the device can play audio. Default value is "yes". Whether the device supports insertion/removal of virtual SD Cards. Default value is "yes". Whether we use a /cache partition on the device. Default value is "yes".

hw.audioInput hw.audioOutput hw.sdCard

disk.cachePartition

VIRUS | Confidential

ANDROID
Cache partition size Abstracted LCD density Default value is "66MB". Sets the generalized density characteristic used by the AVD's screen. Default value is "160". Whether there is a trackball present. disk.cachePartition.size hw.lcd.density

December 8, 2011

Trackball support

hw.trackBall

ADT : Android Development Tools


Android Development Tools (ADT) is a plugin for the Eclipse IDE that is designed to give you a powerful, integrated environment in which to build Android applications. ADT extends the capabilities of Eclipse to let you quickly set up new Android projects, create an application UI, add components based on the Android Framework API, debug your applications using the Android SDK tools, and even export signed (or unsigned) .apk files in order to distribute your application. Developing in Eclipse with ADT is highly recommended and is the fastest way to get started. With the guided project setup it provides, as well as tools integration, custom XML editors, and debug ouput pane, ADT gives you an incredible boost in developing Android applications.

NDK : Native Development Kit


The Android NDK is a toolset that lets you embed components that make use of native code in your Android applications. Android applications run in the Dalvik virtual machine. The NDK allows you to implement parts of your applications using native-code languages such as C and C++. This can provide benefits to certain classes of applications, in the form of reuse of existing code and in some cases increased speed.

The NDK provides:


A set of tools and build files used to generate native code libraries from C and C++ sources A way to embed the corresponding native libraries into an application package file (.apk) that can be deployed on Android devices A set of native system headers and libraries that will be supported in all future versions of the Android platform, starting from Android 1.5. Applications that use native activities must be run on Android 2.3 or later. Documentation, samples, and tutorials

The latest release of the NDK supports these ARM instruction sets:
ARMv5TE (including Thumb-1 instructions) ARMv7-A (including Thumb-2 and VFPv3-D16 instructions, with optional support for NEON/VFPv3-D32 instructions) VIRUS | Confidential

ANDROID
x86 instructions (see CPU-ARCH-ABIS.HTML for more information)

December 8, 2011

ARMv5TE machine code will run on all ARM-based Android devices. ARMv7-A will run only on devices such as the Verizon Droid or Google Nexus One that have a compatible CPU. The main difference between the two instruction sets is that ARMv7-A supports hardware FPU, Thumb-2, and NEON instructions. You can target either or both of the instruction sets ARMv5TE is the default, but switching to ARMv7-A is as easy as adding a single line to the application's Application.mk file, without needing to change anything else in the file. You can also build for both architectures at the same time and have everything stored in the final .apk. Complete information is provided in the CPU-ARCH-ABIS.HTML in the NDK package. The NDK provides stable headers for libc (the C library), libm (the Math library), OpenGL ES (3D graphics library), the JNI interface, and other libraries, as listed in the Development Tools section.

When to Develop in Native Code


The NDK will not benefit most applications. As a developer, you need to balance its benefits against its drawbacks; notably, using native code does not result in an automatic performance increase, but always increases application complexity. In general, you should only use native code if it is essential to your application, not just because you prefer to program in C/C++. Typical good candidates for the NDK are self-contained, CPU-intensive operations that don't allocate much memory, such as signal processing, physics simulation, and so on. Simply re-coding a method to run in C usually does not result in a large performance increase. When examining whether or not you should develop in native code, think about your requirements and see if the Android framework APIs provide the functionality that you need. The NDK can, however, can be an effective way to reuse a large corpus of existing C/C++ code.

The Android framework provides two ways to use native code:


Write your application using the Android framework and use JNI to access the APIs provided by the Android NDK. This technique allows you to take advantage of the convenience of the Android framework, but still allows you to write native code when necessary. You can install applications that use native code through the JNI on devices that run Android 1.5 or later. Write a native activity, which allows you to implement the lifecycle callbacks in native code. The Android SDK provides the NativeActivity class, which is a convenience class that notifies your native code of any activity lifecycle callbacks (onCreate(), onPause(), onResume(), etc). You can implement the callbacks in your native code to handle these events when they occur. Applications that use native activities must be run on Android 2.3 (API Level 9) or later. You cannot access features such as Services and Content Providers natively, so if you want to use them or any other framework API, you can still write JNI code to do so.

Contents of the NDK


The NDK contains the APIs, documentation, and sample applications that help you write your native code.

Development tools
The NDK includes a set of cross-toolchains (compilers, linkers, etc..) that can generate native ARM binaries on Linux, OS X, and Windows (with Cygwin) platforms. VIRUS | Confidential

ANDROID
libc (C library) headers libm (math library) headers JNI interface headers libz (Zlib compression) headers liblog (Android logging) header OpenGL ES 1.1 and OpenGL ES 2.0 (3D graphics libraries) headers libjnigraphics (Pixel buffer access) header (for Android 2.2 and above). A Minimal set of headers for C++ support OpenSL ES native audio libraries Android native application APIS

December 8, 2011

It provides a set of system headers for stable native APIs that are guaranteed to be supported in all later releases of the platform:

The NDK also provides a build system that lets you work efficiently with your sources, without having to handle the toolchain/platform/CPU/ABI details. You create very short build files to describe which sources to compile and which Android application will use them the build system compiles the sources and places the shared libraries directly in your application project. Important: With the exception of the libraries listed above, native system libraries in the Android platform are not stable and may change in future platform versions. Your applications should only make use of the stable native system libraries provided in this NDK.

Documentation
The NDK package includes a set of documentation that describes the capabilities of the NDK and how to use it to create shared libraries for your Android applications. In this release, the documentation is provided only in the downloadable NDK package. You can find the documentation in the <ndk>/docs/ directory. Included are these files: INSTALL.HTML describes how to install the NDK and configure it for your host system OVERVIEW.HTML provides an overview of the NDK capabilities and usage ANDROID-MK.HTML describes the use of the Android.mk file, which defines the native sources you want to compile APPLICATION-MK.HTML describes the use of the Application.mk file, which describes the native sources required by your Android application CPLUSPLUS-SUPPORT.HTML describes the C++ support provided in the Android NDK CPU-ARCH-ABIS.HTML a description of supported CPU architectures and how to target them. CPU-FEATURES.HTML a description of the cpufeatures static library that lets your application code detect the target device's CPU family and the optional features at runtime. CPU-ARM-NEON.HTML a description of how to build with optional ARM NEON / VFPv3-D32 instructions. CHANGES.HTML a complete list of changes to the NDK across all releases. DEVELOPMENT.HTML describes how to modify the NDK and generate release packages for it HOWTO.HTML information about common tasks associated with NDK development IMPORT-MODULE.HTML describes how to share and reuse modules LICENSES.HTML information about the various open source licenses that govern the Android NDK NATIVE-ACTIVITY.HTML describes how to implement native activities NDK-BUILD.HTML describes the usage of the ndk-build script NDK-GDB.HTML describes how to use the native code debugger PREBUILTS.HTML information about how shared and static prebuilt libraries work VIRUS | Confidential

ANDROID

December 8, 2011

STANDALONE-TOOLCHAIN.HTML describes how to use Android NDK toolchain as a standalone compiler (still in beta). SYSTEM-ISSUES.HTML known issues in the Android system images that you should be aware of, if you are developing using the NDK. STABLE-APIS.HTML a complete list of the stable APIs exposed by headers in the NDK.

Additionally, the package includes detailed information about the "bionic" C library provided with the Android platform that you should be aware of, if you are developing using the NDK. You can find the documentation in the <ndk>/docs/system/libc/ directory: OVERVIEW.HTML provides an overview of the "bionic" C library and the features it offers

The Structure of Android Package (APK) Files .apk file


Android application package file. Each Android application is compiled and packaged in a single file that includes all of the application's code (.dex files), resources, assets, and manifest file. The application package file can have any name but must use the .apk extension. For example: myExampleAppname.apk. For convenience, an application package file is often referred to as an ".apk". 1. Introduction

One who has been engaged in developing Android applications must be very familiar with Android Package (APK) files. Each application to be installed on OPhone is compiled and packed into one single file with an extension of apk. This package file contains all binary codes, resources, and profiles of the application. This document briefs the structure and contents of an .apk file, as well as the de-compilation of a .dex file included in the .apk file through a concrete example.

2. Example: Hello World

For the sake of convenience, let's firstly take a look at the example application, a small, simple application named Hello World. Its directory structure is as follows: |-- AndroidManifest.xml |-- assets |-- bin |-- default.properties |-- res | |-- drawable | | `-- icon.png | |-- layout VIRUS | Confidential

ANDROID

December 8, 2011

| | `-- main.xml | `-- values | `-- strings.xml `-- src `-- hello `-- world `-- hello.java In this case, the development environments used include Eclipse, adt0.9, and Android SDK 1.5-r3. All files and directories shown in the figure above are automatically generated by configuration interaction. The hello.java is the only part that is modified in this example. After the modification, the text "Hello, OPhone" is displayed on the screen during the initialization of the application. The source codes are shown as follows. Please be kindly advised that the modified codes are highlighted in bold. package hello.world; 1. import android.app.Activity; 2. import android.os.Bundle; 3. import android.widget.TextView; 4. 5. public class test extends Activity { 6. /** Called when the activity is first created. */ 7. @Override 8. public void onCreate(Bundle savedInstanceState) { 9. super.onCreate(savedInstanceState); 10. TextView test = new TextView(this); 11. Test.setText("hello, OPhone"); 12. setContentView(test); 13. } 14. } The directory structure has changed somewhat after being recompiled by using Eclipse. The directories /bin and /gen are generated after compilation. |-- AndroidManifest.xml |-- assets |-- bin | |-- classes.dex | |-- hello | | `-- world | | |-- R$attr.class | | |-- R$drawable.class | | |-- R$layout.class | | |-- R$string.class | | |-- R.class | | `-- hello.class | |-- helloworld.apk | `-- resources.ap_ |-- default.properties |-- gen | `-- hello | `-- world | `-- R.java |-- res VIRUS | Confidential

ANDROID

December 8, 2011

| |-- drawable | | `-- icon.png | |-- layout | | `-- main.xml | `-- values | `-- strings.xml `-- src `-- hello `-- world `-- hello.java An R.java file is created under the directory /gen by the system resource files. Meanwhile, 6 .class files and a helloworld.apk file are generated under the directory /bin as well. Let's take an in-depth look into this file in the next section. 3. The Structure of .APK Files

An .apk file is actually a zip compression package, which can be easily decompressed with decompression tools. The following is what we can see after the helloworld.apk file is decompressed using any Zip utility. We can see that its structure is somewhat similar to that of the new project. |-- AndroidManifest.xml |-- META-INF | |-- CERT.RSA | |-- CERT.SF | `-- MANIFEST.MF |-- classes.dex |-- res | |-- drawable | | `-- icon.png | `-- layout | `-- main.xml `-- resources.arsc 3.1 Manifest File AndroidManifest.xml is a required file for any application. It describes the name, version, access rights, referenced library files, and other information [ , ] of the application. If you intend to upload the .apk file to Google Market, you need to configure this .xml file. Here we skip it since there are too many references on this topic on the Internet. The AndroidManifest.xml contained in the .apk file has been compressed. It can be decompressed using AXMLPrinter2 [ , ]. The command used is as follows: java -jar AXMLPrinter2.jar AndroidManifest.xml

3.2 META-INF Directory META-INF Directory, where signature data is stored, is used to ensure the integrality of the .apk package and system security. When using eclipse to create an API package, a check calculation is performed against all files to be packed. The calculation results are stored in the META-INF directory. When installing an .apk package on OPhone, the application manager will implement the same procedure above. If the result is different from that under the META-INF directory, the system will not VIRUS | Confidential

ANDROID

December 8, 2011

install the .apk file. This helps ensure that the files contained in the .apk package will not be replaced randomly. For example, it is basically impossible to replace any picture, code fragment, or copyright data in the .apk package by directly decompressing the file, replacing such content, and then repacking it. Therefore, this may protect the system from virus infection and malicious modification, increasing the system security.

3.3 Classes.dex File

Classes.dex is a java byte code file generated after the compilation using java source codes. The Dalvik virtual machine used by Android is not compatible with typical java virtual machine. Therefore, the structure and opcode of .dex files are different from .class files. All java decompilers available now can not process .dex files. Android emulator provides a decompilation tool, dexdump, which can be used to decompile .dex files. First, start the Android emulator, and upload the .dex file into the emulator through Adb push. Find the .dex file after logging in through Adb shell. Implement the following command: dexdump xxx.dex. Here we use the Hello World as an example as well. 1. # dexdump classes.dex 2. Processing 'classes.dex'... 3. Opened 'classes.dex', DEX version '035' 4. Class #0 5. Class descriptor : 'Lhello/world/R$attr;' 6. 7. Class #5 8. Class descriptor : 'Lhello/world/hello;' 9. Access flags : 0x0001 (PUBLIC) 10. Superclass : 'Landroid/app/Activity;' 11. Interfaces 12. Static fields 13. Instance fields 14. Direct methods 15. #0 : (in Lhello/world/hello;) 16. name : '<init>' 17. type : '()V' 18. access : 0x10001 (PUBLIC CONSTRUCTOR) 19. code 20. registers : 1 21. ins :1 22. outs :1 23. insns size : 4 16-bit code units 24. catches : (none) 25. positions : 26. 0x0000 line=7 27. locals : 28. 0x0000 - 0x0004 reg=0 this Lhello/world/hello; 29. Virtual methods 30. #0 : (in Lhello/world/hello;) 31. name : 'onCreate' 32. type : '(Landroid/os/Bundle;)V' VIRUS | Confidential

ANDROID
33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. access : 0x0001 (PUBLIC) code registers : 4 ins :2 outs :2 insns size : 17 16-bit code units catches : (none) positions : 0x0000 line=11 0x0003 line=13 0x0008 line=14 0x000d line=15 0x0010 line=16 locals : 0x0008 - 0x0011 reg=0 test Landroid/widget/TextView; 0x0000 - 0x0011 reg=2 this Lhello/world/hello; 0x0000 - 0x0011 reg=3 savedInstanceState Landroid/os/Bundle; source_file_idx : 27 (hello.java)

December 8, 2011

The results show that 6 class files (class0 to class5) are found, corresponding to the number of the .class under the directory /bin. We can tell from this that all .class files are included in the .dex file. However, it is very hard to find out the modification that has been made from the decompilation results of hello.java in Class #5. So, how to output "Hello, OPhone" becomes a problem. If the decompilation of branch jump table is incomplete, the dump is also incomplete. This problem also exists with fill-array data table. Besides, there are many other disadvantages. In a word, the decompilation results of dexdump are hard to read. Dedexer is another tool available on the Internet at present. It can read .dex files with output in assemblylike language. The output is similar to jasmin[ ] output, but includes Dalvik byte codes. More details about Dedexer will be given in the next section.

3.4 Res Directory Res directory is used to store resource files. For details about resource manager in .apk files, please refer to related articles on the OPhone SDN website.

3.5 resources.arsc It is a binary resource file after compilation.

4. Dedexer Dedexer is the only open-source tool [ ] available on the Internet for dex file decompilation. After successfully downloading from the Internet, it must be compiled before use. It could be a piece of cake if you have ever used Ant to compile any java application. Note that Dedexer 1.5 is the latest version, and only junit4.5 can be used to compile it. Let's take Linux environment as an example to show the compilation and utilization of Dedexer. Download and decompress Ddx1.5.zip. A directory including a build.xml file is generated. Configure the build.xml file according to the environment of PC. The following in bold is the configuration of my computer.

VIRUS | Confidential

ANDROID

December 8, 2011

1. <!-- Directories of the project -> <property name="home" value="/home/danny/myproject/dedex/dedexer"/> <property name="junithome" value="/home/danny/myproject/dedex"/> <!-- Directories derived from the source tree root -> <property name="classdir" value="${home}/classes"/> <property name="src" value="${home}/sources"/ > <property name="testbase" value="${home}/testfiles"/> <!-- Directories derived from the JUnit base -> <property name="junit_jar" value="${junit-home}/junit-4.5.jar"/> Start compilation after environment configuration. Make sure that the Ant compiler has been installed properly. Then launch Ant. 1. danny@dannydesktop:~/myproject/dedex$ ant Buildfile: build.xml init: [mkdir] Created dir: /home/danny/myproject /dedex/dedexer/classes 2. compile: [javac] Compiling 48 source files to /home/danny/myproject/dedex/dedexer/classes [jav ac] Note: /home/danny/myproject/dedex/dedexer/sources/hu/uw/pallergabor/dedexer/Annotation.j ava uses unchecked or unsafe operations. [javac] Note: Recompile with Xlint:unchecked for details. package: [jar] Building jar: /home/danny/myproject/dedex/dedexer/dd x.jar 3. BUILD SUCCESSFUL 4. Total time: 3 seconds Here the compilation of dedexer is finished in 3 seconds. A ddx.jar file is generated. I usually prefer to add the version number to its file name. The commands used are as follows: 1. danny@danny-desktop:~/myproject/dedex$ java -jar ddx1.5.jar d [target folder] classes.dex Processing hello/world/R$string Processing hello/world/R$layout Processing hello/world/hello Processing hello/world/R$attr Processing hello/world/R Processing hello/world/R$draw able Dedexer generates a .ddx file for each .class file. As expected, 6 .ddx files are generated in this example. 1. danny@dannydesktop:~/myproject/dedex$ ls hello/world/R$attr.ddx R.ddx R$drawable.ddx R$layout.ddx R$string.ddx hello.ddx Take a close look at hello.ddx. 1. class public hello/world/hello 2. .super android/app/Activity 3. .source hello.java 4. 5. .method public <init>()V 6. .line 7 7. invoke-direct {v0},android/app/Activity/<init> 8. return-void 9. .end method 10. 11. .method public onCreate(Landroid/os/Bundle;)V 12. .line 11

; <init>()V

VIRUS | Confidential

ANDROID
13. 14. 15. 16. 17. 18. 19. 20. 21.

December 8, 2011

invoke-super {v2,v3},android/app/Activity/onCreate ; onCreate(Landroid/os/Bundle;)V .line 13 new-instance v0,android/widget/TextView invoke-direct {v0,v2},android/widget/TextView/<init> ; <init>(Landroid/content/Context;)V .line 14 const-string v1,"hello, OPhone" invoke-virtual {v0,v1},android/widget/TextView/setText ; setText(Ljava/lang/CharSequence;)V .line 15 invokevirtual {v2,v0},hello/world/hello/setContentView ; setContentView(Landroid/view/View;)V 22. .line 16 23. return-void 24. .end method

From the results of decompilation, the codes are still hard to read, but better than dexdump. We may find that the string of "Hello, OPhone" is called by invoke-virtual {v0, v1}, and Android/Widget/TextView/setText. Compared with Dexdump, Dedexer has the following advantages at least: 1) Android emulator is not needed. 2) The directory of the .dex file is built in accordance with that of java resource code package. Each class file corresponds to a .ddx file. In the case of Dexdump, all results are stored in one place. 3) According to its developer, Dedexer can be used as a decompilation engine similar to Jasmin that has been used as the engine for many powerful java decompilation tools.

5. Conclusion This document briefs the structure and content of .apk files as well as the usage of Dedexer, a popular decompilation tool. I hope this could help more people better understand the structure of .apk files, and learn more about Dedexer to develop more powerful, efficient decompilers for .dex files.

VIRUS | Confidential

ANDROID

December 8, 2011

How to import existing Android project into Eclipse?


1. 2. 3. 4. 5. File >> Import >> General >>Existing Projects into Workspace, Next Select root directory: /path/to/project Projects >>Select All UNCHECK both "Copy projects into workspace" and "Add project to working sets" Finish

VIRUS | Confidential

You might also like