May 24

Android Basic concepts

Android Basic concepts 



:Theoretical Background


Android Studio / Eclipse:

Android Studio and Eclipse are the IDEs for developing android applications.



Android Development Tools, it is the plugin required for Eclipse in order to develop for Android, it contains the DDMS = Dalvik Debug Monitor Service, the Logcat and more tools.


Android SDK:

The Android Software Development Kit is used to enable developers to develop for Android.

It contains:

- tools – Set of tool for development and debugging tools for android, they are platform independent and they are required no matter which android platform you are developing for. For example, the Emulator and the DDMS.

- platform-tools – Set of tools that are customized to support the features of the latest android platform. For example,  the adb – Android Debug Bridge. (tool that act as a bridge to communicate with the emulator or the android device).

- build-tools – Component of the android sdk used for compiling to .dex file.

- docs – Documents about the android APIs.

- samples – Sample code for android development.

- sources – The source code for the Android framework. You can download from the SDK manager the source code for each Android version. For example, if I downloaded for android version 21 (Lollipop) I will see under sources a folder: sources\android-21 and if I want for example to look for the Console code I will see it in: sources\android-21\java\io\Console.java. Android specific code like TextView I will be found in: sources\android-21\android\widget.

- platforms – Inside platform we will see folder named: android-x, these folders contain the android platform files, resources, fonts, the byte code of the platform and more. When we install from the SDK Manager the SDK platform for android version-y we will see that it will create in platforms a sub folder named: platforms\android-y containing the framework for android version-y.

- platforms\android-x\android.jar – When we are creating an android program for android version-x we will be referencing a very important jar, the platforms\android-x\android.jar, this jar contains all the *.class files, the binary compiles files, of the Android source code, for example: \android\widget\TextView.class.

- AVD Manager.exe – The tool we use to manage Android Virtual Devices.

- SDK Manager.exe – The tool we use to download all our Android related services.


About the android.jar:

Not ALL the source code is compiled to this jar, some source code is hidden or internal and is intended to be used only by Google, by the android platform, it is not intended for use for development, So it doesn’t get compiled, we can still see it in the source code if we look, but it won’t be compiled and when we develop we won’t be able to use it.
For example:

Internal: if we take a look at source-code\com\android\internal we will see many classes, but if we decompress the android.jar we will see that they are not found there in: android.jar\com\android\internal.
Hidden: there are some methods marked as @hide that are not compiled, for example in: source-code\android\net\wifi\WifiManager.java:


     * @hide - hide this because it takes in a parameter of type IWifiManager, which
     * is a system private class.
    public WifiManager(Context context, IWifiManager service) {


     * Broadcast intent action indicating whether Wi-Fi scanning is allowed currently
     * @hide
    public static final String WIFI_SCAN_AVAILABLE = "wifi_scan_available";


And if we try to code in our IDE:


We will get an error saying “cannot resolve symbol ‘WIFI_SCAN_AVAILABLE’” as it this static member of the WifiManager does not exist in the WifiManager.class in the android.jar referred to by our program.



Every android device has a jar named framework.jar in: /system/framework/framework.jar, this jar is similar to the android.jar we use to reference in our development environment when we develop an android application,

When we run an application it loads the framework.jar, and this jar also has all of the internal APIs and the hidden APIs which we weren’t able to use in our computer.

(Side note: we can use reflection to write code that access this private/hidden APIs that will run well on a device, as the device has these APIs)


APK Files:

Android Application Package is a specific type of archive file that is used for installation of an android application, it can be extracted just like any other .zip / .rar file.

An APK file contains all the files required to install an android application:

1. The compiled code in a dex format: apk\classes.dex,

2. The manifest file: apk\AndroidManifest.xml

3. Compiled resources: apk\resources.arcs

4. A binary version of the AndroidManifest.xml and certificates: apk\META-INF

5. Raw resources: at folder res: apk\res

6. The native libraries: apk\lib\<platform-specific-architecture>\*.so file


DEX files:

During compilation of an android application all the java byte code classes: *.class are converted to a single .dex file, this dex file is a file that contains our  code but in Dalvik/ART byte code format that will be readable by the Android Virtual Machine, be it Dalvik or ART.


בהצלחה !

Leave a Reply

Your email address will not be published.

אתם יכולים להשתמש באפשרויות ותגי ה-HTMLהבאים: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>