0% found this document useful (0 votes)
8 views16 pages

Gradle Debugging in Android Development

The document discusses Android app development tools. It covers the Android Studio IDE, the Gradle build manager, debugging concepts and errors, and the Android Debug Bridge (ADB). Android Studio is used to write, build, and debug Android code, while Gradle compiles the code and ADB facilitates deployment to virtual and physical devices. Different types of coding errors like syntax, semantic, and logical errors can occur at various stages and the debugger helps locate runtime issues.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views16 pages

Gradle Debugging in Android Development

The document discusses Android app development tools. It covers the Android Studio IDE, the Gradle build manager, debugging concepts and errors, and the Android Debug Bridge (ADB). Android Studio is used to write, build, and debug Android code, while Gradle compiles the code and ADB facilitates deployment to virtual and physical devices. Different types of coding errors like syntax, semantic, and logical errors can occur at various stages and the debugger helps locate runtime issues.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd

Mobile Device Development

Android Studio IDE Details


Gradle Build Manager and Debugging
Concepts
Code Review and OOP Features
Mobile Device Development UFCFX5-15-3
Agenda

 Android IDE and Project Navigation


 The Gradle Build Manager
 Setting the Minimum Android SDK via Gradle
 Code Structure and Variable Declaration
 Code Errors and Debugging Concepts
 Android Debug Bridge (ADB
 Code Review

Mobile Device Development UFCFX5-15-3


Android Studio IDE

Project Android Code Editor UI and XML


Window Layout Window

Gradle Build Manager Debugger

Android SDK Manager

Java Development Kit

Mobile Device Development UFCFX5-15-3


Mobile Device Development UFCFX5-15-3
Gradle Build Manager
 Gradle is an integrated build manager.
 It uses its own Domain Specific Language (DSL).
 The Gradle build process gathers all source files e.g.
.java .xml and associated resources.
 Applies the appropriate command line tool within the
SDK to compile the sources to an Android Package
file (.apk).
 Deploys the .apk file to a virtual or real device.
 Supports user-defined custom build scripts.

Mobile Device Development UFCFX5-15-3


Setting the Minimum Android
SDK via Gradle

Mobile Device Development UFCFX5-15-3


Types of Coding Errors
 Structural - Errors in the placement of code sections.

 Syntax (compile time)


 Errors in the way the code is written - missing ; keywords
misspelled, lower / uppercase errors
 Semantic ( run time)
 Errors in code meaning – variables not initialised causing
null object assignment, file read/write io errors, arrays out of
bounds errors,
 Logical (run time)
 Errors in code calculation - incorrect output from given input -
app works but output results not reliable
Mobile Device Development UFCFX5-15-3
Code Structure and Variable
Declaration
 Imports
 Class name definition

 Global variable declarations

• OnCreate method
• Local variable declarations
Further (inner) class definitions and local methods

Mobile Device Development UFCFX5-15-3


Structural Error (compile time)
onCreate(){
int value;

value = getRandomNumber();

class SetImage(){

//class code etc

} // end SetImage

} // end onCreate

Mobile Device Development UFCFX5-15-3


Syntax Errors (compile time)

int firstNumber = 0;
int secondNumber = 0;
typo

firstnumber = firstNumber + 1;

secondNumber = firstNumber

missing ;

Mobile Device Development UFCFX5-15-3


Symantec Error (run time)

Call in code [Link]


ClickmyTextView
misspelling in activity_main.xml:
ClickmiTextView
This will cause the app to crash when the textview is selected

Mobile Device Development UFCFX5-15-3


Logical Error (run time)
float PI = 3.142;
float areaOfCircle;
float radius;

areaOfCircle = PI * 2 * radius;

// wrong formula, should be:

areaOfCircle = PI * r * r;

Mobile Device Development UFCFX5-15-3


Code Debugger

 A debugger is computer software designed to find


errors in a computer program.
 Debugging is usually necessary to detect runtime errors
i.e. semantic and logical errors.
 The debugging software has facilities to pause the
program execution at a given point (breakpoint), then
proceed to process each code statement in a
stepwise manner.

Mobile Device Development UFCFX5-15-3


Typical Debugging Facilities

 Process single code statements line by line.


 Step into or over code fragments e.g. conditions and
loops.
 Step ‘into’ or ‘over’ method and method calls.
 Set ‘watch windows’ to track variable assignment and
values in order to track errors in computation. Track
bounds errors, e.g. array assignment overflow.

Mobile Device Development UFCFX5-15-3


Android Debug Bridge (ADB)
 Install apps to android devices from PC -d for direct an adb
command to the only
 adb –d install [Link] (android package) attached USB device
 Install apps to android emulator.
 adb install [Link]
 Kill and restart adb thread
 adb kill-server
 adb start-server
 Copy files from PC to android devices
 adb push [Link] /sdcard/

Mobile Device Development UFCFX5-15-3


Summary

• Android is the Integrated Development Environment (IDE) for Android


app development. It allows apps to be directly deployed onto the android
device via the Gradle Build Manager It also facilitates testing and
debugging code on a real device.
• Using the Android emulator/android virtual device is another way to test
and debug the android app.
• Code errors can be found at compile time (syntax) and runtime (semantic,
logical). The integrated debugger can assist in locating runtime errors.
• ADB can be used via command line commands and arguments to install
files to devices

Mobile Device Development UFCFX5-15-3

You might also like