Posts

Showing posts with the label Android

Unable to execute dex: Multiple dex files define

This is probably because the same jar is included more than once in your project.  If so, ensure that your project only includes it once (that it doesn't appear in referenced library projects, or build paths, etc).

Zygote in Android

when an application is launched , the core process for the application is forked from Zygote. Zygote has all the core libraries and hence all applications share these libraries from Zygote. Zygote is also used to share the system drawables with all the apps. This allows the system to load the bitmaps for buttons only once for instance. Zygote System Process The important processes in the system appear to be zygote (which is the app_process binary), and runtime. These are both started up by the init process. The following fragment of init.rc is relevant. It is important to note that these services have the autostart 1 attribute, indicating they are restarted if they quit. zygote { exec /system/bin/app_process args { 0 -Xzygote 1 /system/bin 2 --zygote } autostart 1 } runtime { exec /system/bin/runtime autostart 1 } If we go and kill either the zygote, or runtime process ...

Looper in Android

What is Looper? Looper is a class which is used to execute the Messages(Runnables) in a queue. Normal threads have no any queue. For example, Simple thread do not have any queue. It is one time execution and after end of the code the thread will be stopped and it will not able to run another Message(Runnable). Where we can use Looper class? If someone wants to execute multiple messages(Runnables) then he should use the Looper class which is responsible for create a queue in the thread. For example. If we are writing an application which downloads files from the internet then we can use Looper class for put a files in the queue to be download. How it works? There is prepare() method to prepare the Looper. Now after that you can use loop() method to create a message loop in the current thread and now your looper is ready to execute the requests in the queue until you quit the loop. Here is the code by which you can prepare the Looper. class LooperThread extends Thr...

Android Boot Sequence

Image
Android is linux based open source operating system, x86 (x86 is a series of computer microprocessor instruction set architectures based on the Intel 8086 CPU.) is most likely system where linux kernel is deployed however all Android devices are running on ARM process (ARM (formerly Advanced RISC Machine, which was formerly Acorn RISC Machine)) except Intel’s Xolo device ( http://xolo.in/xolo-x900-features ). Xolo comes with Atom 1.6 GHz x86 processor. Android boot sequence or I can say embedded device or ARM based linux has minor difference compare to desktop version.  In this article I am going to explain boot sequence for Android only. Inside the linux boot process is good article for desktop based linux boot sequence. Android device execute following steps when you press power switch Android Boot Sequence / Process Step 1 : Power On and System Startup When power start Boot ROM code start execution from pre defined location which is hardwired on ROM. It lo...

Android: Activity launch mode

A task is the stack ("Last in, First out") which contains a collection of activity instances. Normally, when a user starts an app a new task will be created, and the first activity instance is called as a root of the task. The Android system can hold multiple tasks at the same time and only one task is in the foreground. Similar to a double click of the home key on iOS, if you long press the HOME key on Android you'll be presented with a list of your currently running applications. You can select any one of these applications (which are currently running in the background) in order to bring it to the foreground and interact with the app! Of course, because background tasks do tend to use up your processor cycles you should try to keep your backgrounded apps to a minimum to ensure your phone performs optimally. Now let's look at the launch mode of an activity. Launch mode allows you to define how a new instance or the existing instance of an activity ...

Image and graphics tips for Android

Image
This article provides some practical tips to help you achieve the best visual quality on all devices for your Android app. The look of your app is important. For users, it's the first quality indicator they see. Attractive design, clear and effective layouts that feel optimal on the user's device, and high quality icons, graphics, and images, send clear quality messages. Visual quality also contributes to both the functionality and usability of your app. For example, legible fonts and font sizes, and colour palettes that enhance legibility, are functionally essential, not just nice-to-haves. The importance of consistency and scalability The biggest issue affecting how an Android app looks on a given device is scaling. Compared to some platforms (for example iOS and Blackberry), the variation in physical display characteristics between devices based on the same or compatible Android software versions, can be much greater. Android solves this problem by...

Different layouts for different screen sizes in Android

Image
Android ( Version less than 3.2 or API Level less than 13 )  classifies the screen sizes into four different groups such as small, normal, large and extra large. The resolutions of small, normal, large and extra large are at least 426 x 320 , 470 x 320 ,  640 x 480 and 960 x 720 respectively where all the resolution values are measured in the unit “dp”. The layout file for the small screen devices are stored in the folder res/layout-small. Similarly layout folders for normal, large and extra large screens are stored in res/layout-normal, res/layout-large and res/layout-extra respectively. Beginning from Android version 3.2( API Level 13), there is no such thing as size grouping. That is size grouping is deprecated from Android version 3.2 onwards. From Android 3.2 onwards, the smallest width required for a layout file is specified. This is done by specifying directory name as “layout-sw<N>dp” where <N> is the smallest width of the screen in the unit...