Sunday 24 April 2011

Android Platform Debugging:

Process For Platform Debugging:
Steps:
* Get into the Source Root folder and type environment setup command ------>  "source build/envsetup.sh"
* Choose which target to build with lunch. The exact configuration can be passed as an argument ----> "lunch"
* Build the source by make command -------> "make"
Emulator launching:
* once the build is over launch the emulator with following instruction
For emulator without keypad:
"sudo out/host/linux-x86/bin/emulator -system out/target/product/generic -kernel prebuilt/android-arm/kernel/kernel-qemu -data out/target/product/generic/userdata.img"
For emulator with keypad:
"out/host/linux-x86/bin/emulator -data out/target/product/generic/userdata.img"
Using Eclipse:
* Go to the eclipse Folder and launch Eclipse -------> ./eclipse.
* copy the .classpath file from "development/ide/eclipse" to root folder. get into your source root folder then type the following with "." in end  --------->  "cp development/ide/eclipse/.classpath ."
* Then "chmod u+w .classpath"
* now the .classpath file is copied. To check list all the files on root folder and find the .classpath file on
that -------> "ll"
* In eclipse now create a new java project   new --> javaproject --> import --> source(path)
* Check weather source included without any error.
* If you are getting following error "
1) 'out/target/common/obj/JAVA_LIBRARIES/google-common_intermediates/javalib.jar'
Generic-Android         Build path      Build Path Problem "
* If u get the problem .jar(out/target/common/obj/JAVA_LIBRARIES/google-common_intermediates/javalib.jar)  change above jar name to "out/target/common/obj/JAVA_LIBRARIES/android-common_intermediates/javalib.jar" on .classpath.
2) 'out/target/common/obj/JAVA_LIBRARIES/gsf-client_intermediates/javalib.jar'
Generic-Android         Build path      Build Path Problem
* If u get the problem .jar file error just delete that line on .classpath.
once these error is closed you may get error on  "com.android.providers.calendar,   com.android.providers.contacts "
* To solve that error we need to import "EventLogTags.java" to their corresponding packages.
1) For error on    "com.android.providers.calendar" eventlogtags  right click on that package  new --> file -->advanced --> link to file in the filesystem --> browse ..your source root -->out -->target --> common -->obj -->Apps -->calenderprovider_intermediates -->srs --> src --> com -->android --> providers --> calender -->EventLogTags.java
2) For error on    "com.android.providers.contacts" eventlogtags  right click on that package  new --> file -->advanced --> link to file in the filesystem --> browse ..your source root -->out -->target --> common -->obj -->Apps -->contactsprovider_intermediates -->srs --> src --> com -->android --> providers --> contacts -->EventLogTags.java
* clean and refresh and build again.
* launch the emulator in another terminal shell.
ddms setup:
* in eclipse goto run --> Debug configuration --> Remote java application --> new
* In project name give your source name.
* Change the port number to 8700 and click Debug.
* Open new terminal shell and start ddms. goto root folder and type ddms.
* Select the process to debug and start debug.

Tuesday 12 April 2011

ANDROID DEBUGGING

PROCEDURE TO CONNECT  GDB CLIENT AND SERVER
RUN THIS COMMAND ON THE DEVICE
COMMAND:

gdbserver :5039 /system/bin/executable
EX:gdbserver :5039 /system/bin/bluetoothd
ON THE HOST MACHINE FORWARD PORT 5039 TO DEVICE WITH ADB

COMMAND:adb forward tcp:5039 tcp:5039
TRY STARTING SPECIAL VERSION OF GDB IN THE PATH "prebuilt" area of the source tree

COMMAND:prebuilt/Linux/
toolchain-eabi-4.2.1/bin/arm-eabi-gdb
RUN FIND IN YOUR SOURCE TREE

COMMAND:
prebuilt -name arm-eabi-gdb
SPECIFY THE PATH FOR REFERENCE

COMMAND:prebuilt/Linux/toolchain-eabi-4.2.1/bin/arm-eabi-gdb  out/target/product/product-name/symbols/system/bin/executable
IN GDB,SPECIFY WHERE TO FIND THE SHARED LIBRARIES THAT WILL GET LOADED:

COMMAND:set solib-absolute-prefix /absolute-source-path/out/target/product/product-name/symbols
set solib-search-path /absolute-source-path/out/target/product/product-name/symbols/system/lib

EX:set solib-absolute-prefix /home/parthiban/mydroid//out/target/product/generic/symbols
set solib-search-path /home/parthiban/out/target/product/generic/symbols/system/lib
absolute-source-path is the path to your source tree; for example, /work/device or /Users/hoser/android/device.
product-name is the same as above; for example, sooner.
CONNECT TO DEVICE BY ISSUING THE GDB COMMAND:
target remote :5039
ALLOW SHARED
COMMAND:
shared

PLEASE POST YOUR DOUBTS AND COMMENTS