Debugging Android Applications

Slides:



Advertisements
Similar presentations
Introduction to Eclipse. Start Eclipse Click and then click Eclipse from the menu: Or open a shell and type eclipse after the prompt.
Advertisements

Android Tools & Wireless ADB Αντρέας Λύμπουρας Θεόφιλος Φωκάς Ζαχαρίας Χ’’Λάμπρου.
Get android development environment running. Install – Get and install JDK 5 or 6 (see link in the.
Java Integrated Development Environments: ECLIPSE Part1 Installation.
Android: Hello World Frank Xu Gannon University. Steps Configuration ▫Android SDK ▫Android Development Tools (ADT)  Eclipse plug-in ▫Android SDK and.
The IDE (Integrated Development Environment) provides a DEBUGGER for locating and correcting errors in program logic (logic errors not syntax errors) The.
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.
Getting Started with Android Programming Note: if you have already installed android development tools, please check that you have the same version as.
© Frank Mueller & Seokyong Hong (TA) North Carolina State University Center for Efficient, Secure and Reliable Computing Android Installation Guide (2)
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.
Android development the first app. Andoid vs iOS which is better? Short answer: neither Proponents on both sides For an iOS side, see this article on.
®® Microsoft Windows 7 for Power Users Tutorial 8 Troubleshooting Windows 7.
CS5103 Software Engineering Lecture 08 Android Development II.
Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013.
Android Programming By Mohsen Biglari Android Programming, Part1: Introduction 1 Part1: Introduction By Mohsen Biglari.
1 Mobile Computing Set Up Copyright 2015 by Janson Industries.
Copyright© Jeffrey Jongko, Ateneo de Manila University Android.
IT 211 Project Integration and Deployment Lab #11.
Java Android-8 Imran Shafi. Lecture Contents  Debugging Android Projects  Java/XML Errors  Debugger  Logcat Utility  Android Debug Bridge (adb) 
ANDROID Presented By Mastan Vali.SK. © artesis 2008 | 2 1. Introduction 2. Platform 3. Software development 4. Advantages Main topics.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Data Storage: Part 2 (File System). Internal Storage versus External Storage Internal storage − for private data –By default, files saved to the internal.
Android for Java Developers Denver Java Users Group Jan 11, Mike
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
© 2005 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Data Structures for Java William H. Ford William R. Topp Appendix E The EZJava.
Overview of Android Application Development
Tools Menu and Other Concepts Alerts Event Log SLA Management Search Address Space Search Syslog Download NetIIS Standalone Application.
Introduction It is developed to create software applications. It is a tool for developers of any program that uses both basic and expert settings. It.
Active-HDL Interfaces Debugging C Code Course 10.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Introduction to Android (Part.
Android Security Auditing Slides and projects at samsclass.info.
Using Microsoft Visual Studio 2005 Original by Suma Rao Revised by John G. McMahon ( 9/6/2008 )
EIE375 BlueJ: Getting Started Dr Lawrence Cheung.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 8 Debugging, Creating Executable Files, and Distributing a Windows Application.
First Venture into the Android World Chapter 1 Part 2.
Mobile Programming Lecture 3 Debugging. Lecture 2 Review What widget would you use to allow the user to enter o a yes/no value o a range of values from.
Debugging Ensemble Productions CAMTA Meeting 11 th November 2010 John Murray.
Slides and projects at samsclass.info. Adding Trojans to Apps Slides and projects at samsclass.info.
사업 1 본부 모바일기술연구소 연구 1 실 연구 2 팀 이현상 주임연구원. 2 Emulator 01. Application Templates 02. XML Editing 03. Lint 05. Layout Editor 04. Debugging Tools 06.
ANDROID APPLICATION DEVELOPMENT. ANDROID DEVELOPMENT DEVELOPER.ANDROID.COM/INDEX.HTML THE OFFICIAL SITE FOR ANDROID DEVELOPERS. PROVIDES THE ANDROID SDK.
Appium with Android Configuration.  Download Appium server:  Choose the latest version of appium.
THE C PROGRAMMING ENVIRONMENT. Four parts of C environment  Main menu  Editor status line and edit window  Compiler message window  “Hot Keys” quick.
Intoduction to Andriod studio Environment With a hello world program.
IE 411/511: Visual Programming for Industrial Applications Lecture Notes #2 Introduction to the Visual Basic Express 2010 Integrated Development Environment.
Netbeans QuickStart. Creating a project File->New Project –For now you want General->Java Application –Then fill in the project details.
Editing and Debugging Mumps with VistA and the Eclipse IDE Joel L. Ivey, Ph.D. Dept. of Veteran Affairs OI&T, Veterans Health IT Infrastructure & Security.
Visual Programming Borland Delphi. Developing Applications Borland Delphi is an object-oriented, visual programming environment to develop 32-bit applications.
1 Adding a Model. We have created an MVC web app project Added a controller class. Added a view class. Next we will add some classes for managing movies.
Introduction to Android Programming
Mobile Device Development
Mobile Device Development
SOP for CSD Log Capture Tool V0.1_
Data Storage: Part 2 (File System)
Obtaining the Required Tools
Important terms Black-box testing White-box testing Regression testing
Important terms Black-box testing White-box testing Regression testing
CMPE419 Mobile Application Development
Android Developer Fundamentals V2 Lesson 1
Testing, debugging, and using support libraries
Mobile Computing With Android ACST 4550 Toast
Software Setup & Validation
Android Application Development
CMPE419 Mobile Application Development
Presentation transcript:

Debugging Android Applications

Tools for Debugging an Android Application The Android Studio Debugger Android Device Monitor encapsulates the Dalvik Debug Monitoring Server (DDMS) and other debug tools Android Debug Bridge (adb) Toast messages Class Log and the LogCat utility ©SoftMoore Consulting

The Android Studio Debugger Android Studio enables you to debug apps running on the emulator or an Android device. With Android Studio, you can Select a device to debug your app on. View the system log. Set breakpoints in your code. Examine variables and evaluate expressions at run time. Run the debugging tools from the Android SDK. Capture screenshots and videos of your app. ©SoftMoore Consulting

Using the Android Studio Debugger Build an APK signed with a debug key and install it on a physical Android device or on the Android emulator. To debug an app in Android Studio: Open the project in Android Studio. Click Debug in the toolbar. On the Choose Device window, select a hardware device from the list or choose a virtual device. Click OK. The app starts on the selected device. ©SoftMoore Consulting

The Android Device Monitor A stand-alone tool that provides a graphical user interface for several Android application debugging and analysis tools. Does not require installation of an integrated development environment. Encapsulates the following tools: DDMS Tracer for OpenGL ES Hierarchy Viewer Systrace Traceview Pixel Perfect magnification viewer ©SoftMoore Consulting

Starting the Android Device Monitor From Android Studio click on the Android Device Monitor toolbar icon or use the menu item Tools → Android → Android Device Monitor From the command line, type monitor or double click monitor.bat in the tools subdirectory of the SDK Note: If you encounter problems running the Android Device Monitor or any of the other debugging tools, try the following: − update Android Studio (Help → Check for Update) − add the tools and the platform-tools subdirectories of the SDK to your PATH environment variable. ©SoftMoore Consulting

Example: Android Device Monitor ©SoftMoore Consulting

The Android Debug Bridge (adb) The Android Debug Bridge (adb) is a command line tool located in the platform-tools directory. Sample adb commands: adb shell create a Linux command-line shell use exit to exit the shell adb shell mkdir /sdcard/app_bkup/ single command to create a shell, make a directory, and exit adb push VSwithKeyboard.apk /sdcard/app_bkup/ copy a file to the device ©SoftMoore Consulting

Toast Messages Class Toast (in package android.widget) can be used to display a brief message to the user. When the view is shown to the user, it appears as a floating view over the application. It will never receive focus. Toast examples volume control brief message saying that your settings have been saved Toast messages can be used both for debugging and as part of an application. ©SoftMoore Consulting

Creating Toast Messages Toast messages are usually created by calling one of the static methods in Toast. static Toast makeText (Context context, int resId, int duration) Make a standard toast that just contains a text view with the text from a resource. static Toast makeText (Context context, CharSequence text, int duration) Make a standard toast that just contains a text view. Notes: Parameter context is usually “this”. Duration is usually one of Toast.LENGTH_SHORT or Toast.LENGTH_LONG. ©SoftMoore Consulting

Example: Creating Toast Messages Toast toast = Toast.makeText(this, R.string.message, Toast.LENGTH_SHORT); // center toast message in display toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); Note: If the parent view does not fill the entire display, use the following to center the toast in within the parent view: toast.setGravity(Gravity.CENTER, toast.getXOffset()/2, toast.getYOffset()/2); ©SoftMoore Consulting

The Log Class The Log class (in package android.util) can be used to “log” messages at runtime. Static methods are used to log messages of various severity levels: Log.e(String tag, String msg): Log an error Log.w(String tag, String msg): Log a warning Log.i(String tag, String msg): Log an informational message Log.d(String tag, String msg): Log a debugging message Log.v(String tag, String msg): Log a verbose message Log.wtf(String tag, String msg): Log a “What a Terrible Failure” message (to report an exception that should never happen) ©SoftMoore Consulting

The Log Class (continued) The “tag” parameter for log methods is usually something like the name of the activity posting the log. There is an alternate version of each log method that has a third parameter of type Throwable; e.g., Log.e(String tag, String msg, Throwable tr): Log an error message and an exception ©SoftMoore Consulting

Example: Using the Log Class private static final String LOG_TAG = "FileStorage"; private static final String FILE_NAME = "datafile.txt"; ... try { FileInputStream fis = openFileInput(FILE_NAME); ... // do something with the file input stream } catch (FileNotFoundException ex) String errorMsg = FILE_NAME + " not found"; Log.e(LOG_TAG, errorMsg, ex); Toast toast = Toast.makeText(FileStorage.this, errorMsg, Toast.LENGTH_SHORT); toast.show(); ©SoftMoore Consulting

The LogCat Utility Developers can view Log messages in Android Studio by clicking on the “6: Android” icon on the bottom of the IDE. The view can be filtered by log level severity or by the tag specified in the method call. Log messages can also be viewed in the debugger in the Android Device Monitor by using the Android Debug Bridge (run the command adb logcat ©SoftMoore Consulting

Relevant Links Debugging Debugging with Android Studio Using DDMS http://developer.android.com/tools/debugging/index.html Debugging with Android Studio http://developer.android.com/tools/debugging/debugging-studio.html Using DDMS http://developer.android.com/tools/debugging/ddms.html Reading and Writing Logs http://developer.android.com/tools/debugging/debugging-log.html Toasts http://developer.android.com/guide/topics/ui/notifiers/toasts.html ©SoftMoore Consulting