Presentation is loading. Please wait.

Presentation is loading. Please wait.

Mobile Device Development

Similar presentations


Presentation on theme: "Mobile Device Development"— Presentation transcript:

1 Mobile Device Development
Android Studio IDE Details Gradle Build Manager and Debugging Concepts Code Review and OOP Features 1

2 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 2

3 Android Studio IDE Project Window UI and XML Layout Window
Android Code Editor Gradle Build Manager Debugger Android SDK Manager Java Development Kit

4

5 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.

6 Setting the Minimum Android SDK via Gradle

7 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 7

8 Code Structure and Variable Declaration
Imports Class name definition Global variable declarations OnCreate method Local variable declarations Further (inner) class definitions and local methods

9 Structural Error (compile time)
onCreate(){ int value; value = getRandomNumber(); class SetImage(){ //class code etc } // end SetImage } // end onCreate 9

10 Syntax Errors (compile time)
int firstNumber = 0; int secondNumber = 0; firstnumber = firstNumber + 1; secondNumber = firstNumber typo missing ; 10

11 Symantec Error (run time)
Call in code MainActivity.java ClickmyTextView misspelling in activity_main.xml: ClickmiTextView This will cause the app to crash when the textview is selected 11

12 Logical Error (run time)
float PI = 3.142; float areaOfCircle; float radius; areaOfCircle = PI * 2 * radius; // wrong formula, should be: areaOfCircle = PI * r * r; 12

13 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.

14 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.

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

16 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 16


Download ppt "Mobile Device Development"

Similar presentations


Ads by Google