Java Android-8 Imran Shafi. Lecture Contents  Debugging Android Projects  Java/XML Errors  Debugger  Logcat Utility  Android Debug Bridge (adb) 

Slides:



Advertisements
Similar presentations
1.A tool helps us mange the state of an emulator instance or Android-powered device 2.It is client-sever program that include three comopnents: 1). A.
Advertisements

Lecture 6 Testing and Debugging on a Physical Android Device and other Power User Stuff.
Programming with Android: SDK install and initial setup Luca Bedogni Marco Di Felice Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna.
Android Tools & Wireless ADB Αντρέας Λύμπουρας Θεόφιλος Φωκάς Ζαχαρίας Χ’’Λάμπρου.
Get android development environment running. Install – Get and install JDK 5 or 6 (see link in the.
The Android Development Environment.  Getting started on the Android Platform  Installing required libraries  Programming Android using the Eclipse.
Android: Hello World Frank Xu Gannon University. Steps Configuration ▫Android SDK ▫Android Development Tools (ADT)  Eclipse plug-in ▫Android SDK and.
V0.01 © 2009 Research In Motion Limited Introduction to Java Application Development for the BlackBerry Smartphone Trainer name Date.
Google Android as a mobile development platform T Internet Technologies for Mobile Computing Olli Mäkinen.
Android Debug Bridge (adb) Chien-Chung Shen CIS, UD
Debugging Android Applications
Views Dwight Deugo Nesa Matic
Getting Started with Linux: Novell’s Guide to CompTIA’s Linux+ (Course 3060) Section 2 Use the Linux Desktop.
Android Programming Beomjoo Seo Sep., 12 CS5248 Fall 2012.
2. Setting Up Your Android Development Environment.
ANDROID PROGRAMMING MODULE 1 – GETTING STARTED
UFCFX5-15-3Mobile Device Development Android Development Environments and Windows.
Setting up the Development Environment Copyright © SUPINFO. All rights reserved Preparation.
SET UP COMPUTER ** PLEASE BE AWARE SCREENSHOTS MAY NOT MATCH **
1 Network File System. 2 Network Services A Linux system starts some services at boot time and allow other services to be started up when necessary. These.
Getting Started with Android Programming Note: if you have already installed android development tools, please check that you have the same version as.
DEMONSTRATION FOR SIGMA DATA ACQUISITION MODULES Tempatron Ltd Data Measurements Division Darwin Close Reading RG2 0TB UK T : +44 (0) F :
INTERNATIONAL SUMMER ACADEMIC COURSE UNIVESITY OF NIS ISAC – Android programming.
SEEM4570: XAMPP, Eclipse, Summary of Html Kangfei Zhao Room 711,ERB
Android Programming. Outline Preparation Create new project Build and Run a project Debug a project Deploy on devices.
Android Application Development 2013 PClassic Chris Murphy 1.
Ch 11 Managing System Reliability and Availability 1.
Android Introduction Platform Overview.
Intro to Android Programming George Nychis Srinivasan Seshan.
CS5103 Software Engineering Lecture 08 Android Development II.
© 2005 by IBM; made available under the EPL v1.0 | March 1, 2005 Tim deBoer Gorkem Ercan Extend WTP Server Tools for your.
@2011 Mihail L. Sichitiu1 Android Introduction Platform Overview.
Hands-On Virtual Computing
XP New Perspectives on Browser and Basics Tutorial 1 1 Browser and Basics Tutorial 1.
Introduction to Android. Android as a system, is a java based operating system that runs on the Linux kernel. The system is very lightweight and full.
Ali Shahrokni Application Components Activities Services Content providers Broadcast receivers.
ANDROID Presented By Mastan Vali.SK. © artesis 2008 | 2 1. Introduction 2. Platform 3. Software development 4. Advantages Main topics.
LiveCycle Data Services Introduction Part 2. Part 2? This is the second in our series on LiveCycle Data Services. If you missed our first presentation,
Android for Java Developers Denver Java Users Group Jan 11, Mike
INSTALLATION HANDS-ON. Page 2 About the Hands-On This hands-on section is structured in a way, that it allows you to work independently, but still giving.
XA R7.8 Link Manager Belinda Daub Sr. Technical Consultant 1.
Hour 7 The Application Layer 1. What Is the Application Layer? The Application layer is the top layer in TCP/IP's protocol suite Some of the components.
Android Security Auditing Slides and projects at samsclass.info.
Android Development Environment Environment/tools Windows Eclipse IDE for Java Developers (v3.5 Galileo) Java Platform (JDK 6 Update 18) Android.
Computer Networking From LANs to WANs: Hardware, Software, and Security Chapter 13 FTP and Telnet.
Android Debug Bridge (adb) Chien-Chung Shen CIS, UD
Mobile Programming Lecture 11 Animation and TraceView.
Configuring and Troubleshooting Identity and Access Solutions with Windows Server® 2008 Active Directory®
Slides and projects at samsclass.info. Adding Trojans to Apps Slides and projects at samsclass.info.
Chapter 5 Introduction To Form Builder. Lesson A Objectives  Display Forms Builder forms in a Web browser  Use a data block form to view, insert, update,
ANDROID APPLICATION DEVELOPMENT. ANDROID DEVELOPMENT DEVELOPER.ANDROID.COM/INDEX.HTML THE OFFICIAL SITE FOR ANDROID DEVELOPERS. PROVIDES THE ANDROID SDK.
PAYware Transact Terminal Interface Manager
Linux Operations and Administration
Introduction to Eclipse Programming with an Integrated Development Environment.
Lecture Set 2 Part A: Creating an Application with Visual Studio – Solutions, Projects, Files 8/10/ :35 PM.
Intoduction to Andriod studio Environment With a hello world program.
Accelerometer based motion gestures for mobile devices Presented by – Neel Parikh Advisor Committee members Dr. Chris Pollett Dr. Robert Chun Dr. Mark.
Windows Server 2003 { First Steps and Administration} Benedikt Riedel MCSE + Messaging
Mobile Device Development
The Distributed Application Debugger (DAD)
SOP for CSD Log Capture Tool V0.1_
Java on the LEGO Mindstorms EV3
Lecture 9: ADB Topics: Basic ADB Commands.
Android training in Chandigarh. What is ADB ADB stands for Android Debug Bridge. It is a command line tool that is used to communicate with the emulator.
Instructor: Prasun Dewan (FB 150,
CS5103 Software Engineering
John D. McGregor Module 0 Session 2 Infrastructure and problem
Testing, debugging, and using support libraries
Lecture 11: ADB Topics: Basic ADB Commands.
Presentation transcript:

Java Android-8 Imran Shafi

Lecture Contents  Debugging Android Projects  Java/XML Errors  Debugger  Logcat Utility  Android Debug Bridge (adb)  Dalvik Debug Monitor Service(DDMS)  Traceview

New Project  Create a new project  Provide project configuration  Everything goes fine (nothing wrong with configuration)

New Project Window

Oops Something Went Wrong (What?)

Error Identification

Xml Error

Fixing Given Error

Take Care of Imports

Coding Problems

Correcting Source Code

Output…. Whats Wrong Now?

Check Manifest

Check Again

Output…. Problem Still There….

Try This …

Output

What did we learn?  XML Problems  Source Code Problems  Manifest Entries  API Problems  Protocols  ….

Exception While navigating through any application one can come across some exception Exception screen with force close option

Logcat Eclipse IDE  Window (Menu)  Show View  Other  Android  Logcat Information Shown: Time, pid, tag, Message

Logcat Commands V (Verbose) Shows everything D (Debug) Shows debug info, warnings, errors I (Information) Shows information, warnings, errors W (Warning) Shows warnings and errors E (Error) Shows errors

How to Log?  To write your own entries from your application into logcat, Android provides methods corresponding to the different entry priorities. The methods are all of the form: Log.x(String tag, String message, [Throwable exception]) Where x can be either v,d,I,w,e Example: try { mc.animateTo(mMyLocationOverlay.getMyLocation()); } catch (Exception e) { Log.i("MicroJobs", "Unable to animate map", e); } mvMap.invalidate();

Android Debug Bridge (ADB)  Android Debug Bridge (adb) is a versatile command line tool that lets you communicate with an emulator instance or connected Android-powered device. It is a client- server program that includes three components: 1) A client, which runs on your development machine. You can invoke a client from a shell by issuing an adb command. Other Android tools such as the ADT plugin and DDMS also create adb clients. 2) A server, which runs as a background process on your development machine. The server manages communication between the client and the adb daemon running on an emulator or device. 3) A daemon, which runs as a background process on each emulator or device instance.

ADB Client/Server Modules  Find adb tool in /platform-tools/  An adb client when starts first checks whether there is an adb server process already running. If not, it starts the server process. Server binds itlself to local TCP port 5037 and listens for commands sent from adb clients  Server then sets up connections to all running emulator/device instances. It locates emulator/device instances by scanning odd- numbered ports in the range 5555 to 5585 (the range used by emulators/devices). Where the server finds an adb daemon, it sets up a connection to that port. Note: Each emulator/device instance acquires a pair of sequential ports — an even-numbered port for console connections and an odd-numbered port for adb connections. For example: Emulator 1, console: 5554; Emulator 1, adb: 5555 Emulator 2, console: 5556; Emulator 2, adb: 5557 …

ADB Commands adb [-d|-e|-s ]

List Devices adb devices Displays a list of devices and emulators that the adb server knows about. This is a good way to find the TCP/IP port for an emulator or device if you don't already know it. The port number is also displayed in the title of each emulator at the top of its window.

Device Prompt adb shell This connects you with a shell running on the target and gives you a # prompt. The shell is a simplified Unix-like shell, so you can use the usual shell commands (ls, cat, rm, ps, etc.) to explore the target and make changes as appropriate. Ctrl-D or exit will get you out of the shell and back to your environment on the host.

Install New Package  adb install [-l] [-r] package This can be used to install or reinstall an application i. The -l option forward-locks the installation (preventing the application from being copied later to another device) ii. The -r option reinstalls the application without overwriting the existing application data. iii. The package must be a valid, signed.apk file for the application to be installed.

Uninstall a package adb uninstall [-k] package  This uninstalls the application with the given package name. The package parameter needs to be the full name of the package, without the ".apk" extension. So to uninstall TestProject, for example, you'd type: adb uninstall com.test.mytestproject If you want to keep the application's associated data, you include the -k option

Push to Device  adb pushlocal remote This command copies a file from the local name on the host to the remote name on the target.

Pull from Device  adb pullremote local This is the counterpart to the previous command, and copies a file from the target to the host.

DDMS: Dalvik Debug Monitor Service

Traceview  Maybe the problem you're trying to debug isn't about functionality  Maybe your application does exactly what it's supposed to do, but takes too long to do it  Wouldn't it be nice to have a way of seeing how the methods within your classes are interacting, and even to keep track of the relative time spent executing in each method?  Traceview is a utility that allow you just that kind of visibility.  It consists of two parts, one that you enable before running your program and one that you work with after the run in order to diagnose your findings:

Runtime Data Collection  One can enable and disable logging for his application  While enabled, routines are linked into application that create a binary trace file on the target  The trace file records every method instantiation and the time spent in each method

Trace Analysis  If you copy the binary trace file from the target to your host, you can run a trace analysis program that displays all the information from the file in graphical form  You can easily observe which methods are consuming most of the runtime, and drill down into those methods to find out which methods they in turn call and which of them consume the most time.

Collecting Trace Data  The routines to perform trace data collection are provided in the Android Software Development Kit  All you have to do is: 1. Import the Debug package (android.os.Debug) into your application. 2. Call startMethodTracing when you want to start collecting trace information. 3. Call stopMethodTracing when you're done.

Collecting Trace Data  The tracing routines always write their trace information to a file on the target's SD card. If you're running on a real device, you need to plug in an SD card. If you're debugging on the emulator, you need to create a virtual SD card and tell the emulator to use it:  Create a virtual SD card with mksdcard.

Create SD Card  From the host command prompt, use the mksdcard utility to create a file that the emulator can use as a virtual SD card:  $ mksdcard -l ANDROID 1024M filename You can create the file anywhere you like, but the root directory for your project is a good place. The utility will allocate a file as big as the size you've given in the mksdcard command (1 GB in the example shown).

Use SD Card  Tell the emulator to use the virtual SD card.  In Eclipse, choose Window Preferences Android Launch. You'll see a box there for emulator options. Add the following option:  -sdcard filename Use the complete path to the file, so the emulator can always find it, no matter where it's running from.