Presentation is loading. Please wait.

Presentation is loading. Please wait.

사업 1 본부 모바일기술연구소 연구 1 실 연구 2 팀 이현상 주임연구원. 2 Emulator 01. Application Templates 02. XML Editing 03. Lint 05. Layout Editor 04. Debugging Tools 06.

Similar presentations


Presentation on theme: "사업 1 본부 모바일기술연구소 연구 1 실 연구 2 팀 이현상 주임연구원. 2 Emulator 01. Application Templates 02. XML Editing 03. Lint 05. Layout Editor 04. Debugging Tools 06."— Presentation transcript:

1 사업 1 본부 모바일기술연구소 연구 1 실 연구 2 팀 이현상 주임연구원

2 2 Emulator 01. Application Templates 02. XML Editing 03. Lint 05. Layout Editor 04. Debugging Tools 06.

3

4  Configuring Graphics Acceleration  AVD Manager Create a new AVD with the Target value of Android 4.0.3 (API Level 15), revision 3 or higher. In the Hardware section, click New, select GPU emulation and set the value to Yes. Do not select the Snapshot: Enabled option. Snapshots are not supported for emulators with graphics acceleration enabled.  Minimum Requirements  Android SDK Tools, Revision 17 or higher.  Android SDK Platform API 15, Revision 3 (ICS - 4.0.3) or higher. 4

5 5

6  Emulator system image for GB and above.  Minimum Requirements  Android SDK Tools, Revision 17 or higher.  Android x86-based system image.  Virtualization extensions technologies Intel Virtualization Technology (VT, VT-x, vmx) extensions. AMD Virtualization (AMD-V, SVM) extensions (only supported for Linux).  Virtualization driver Intel HAXM(Hardware Accelerated Execution Manager) for Windows and MacOS X. KVM(Kernel-based Virtual Machine) for Linux. 6

7  Android SDK Manager  Install Emulator system image: Target API – Intel x86 Atom System Image.  Install Intel HAXM: Extras - Intel Hardware Accelerated Execution Manager.  Execute IntelHAXM  /extras/intel/Hardware_Acc elerated_Execution_Manager/Int elHAXM.exe 7

8  AVD Manager  Create a new AVD with the CPU/ABI value of Intel Atom (x86) 8

9  Telephony: DDMS/Emulator.  Camera: Webcam.  Sensors: Tethered Device.  Multi-Touch: Tethered Device. 9

10  AVD Manager  In the Hardware section, click New, select GSM modem support and set the value to Yes. 10

11  DDMS & Emulator 11

12  AVD Manager  In the Hardware section, click New, select Configures camera facing front or Configures camera facing back are available. And set the value to emulated or webcam0. 12

13 13

14  /tools/apps/SdkController  Connect your device to your computer via USB. Make sure to enable USB Debugging in Settings > Developer Options.  Start this application on your device.  On the computer in a shell, run: adb forward tcp:1970 localabstract:android.sdk.controller  Finally run an emulator with an AVD targeting API 15.  Multi-touch emulation must be explicitly enabled in emulator either by setting "Touch screen type" property to "multi-touch" in AVD Manager, or by starting the emulator with "-screen multi-touch" option. 14

15 15

16 16

17

18  Android ADT supports a new application templates for creating new application, blank activity, master-detail flow, and custom view.  These templates support the Android style guide thus making it faster and easier to build beautiful apps. 18

19  File -> New -> Project -> Android Application Project 19

20 20

21 21

22 22

23 23

24 24  We are not just creating a new activity class.  We are adding registration into the manifest.  We are adding resources into the string file.  And so forth.

25 25

26 26

27 27

28

29  Quick Outline  Added Quick Outline for XML editors.  Shortcut: Ctrl + O 29

30  Code completion  Enhanced the code completion to work with custom views.  Shortcut: Control + Space 30

31  Code completion  Improved code completion for the minSdkVersion and targetSdkVersion attributes in manifest files so that version descriptions are displayed for each of the API levels 31

32  XML new formatter  Shortcut: Ctrl + Shift + F  Indentation  Re Ordering attributes  Formatter style Layouts: Prefer to have a blank line for the elements and one attribute per line. Strings file: One string per line. Manifest file: There are other heuristics which apply. 32

33

34 34

35  Important attributes are highlighted in bold.  Values which have been edited for this widget are shown in blue.  Some default values are shown.  Attributes can be nested.  You can switch to alphabetical sorting.  Advanced properties are hidden by default. 35

36 36

37

38  The Android lint tool is a static code analysis tool that checks your Android project source files for potential bugs and optimization improvements for correctness, security, performance, usability, accessibility, and internationalization.  You can run lint from the command-line or from the Eclipse environment. 38

39  Code scanning workflow with the lint tool. 39

40  If the ADT Plugin is installed in your Eclipse environment, the lint tool runs automatically when you perform one of these actions.  Export an APK.  Edit and save an XML source file in your Android project.  Use the layout editor in Eclipse to make changes. 40

41  Note that when you export an APK, lint only runs an automatic check for fatal errors and aborts the export if fatal errors are found.  You can turn off this automatic checking from the Lint Error Checking page in Eclipse Preferences. 41

42  By default, when you run a lint scan, the tool checks for all issues that are supported by lint.  You can also restrict the issues for lint to check and assign the severity level for those issue.  You can configure lint checking at different levels  Globally, for all projects  Per project  Per file  Per Java class or method (by using the @SuppressLint annotation), or per XML element (by using the tools:ignore attribute.s. 42

43  Global preferences  Open Window > Preferences > Android > Lint Error Checking.  Specify your preferences and click OK.  These settings are applied by default when you run lint on your Android projects in Eclipse. 43

44  Project preferences  Open project context menu > Properties > Android Lint Preferences. 44

45  Project and file-specific preferences  Run the lint tool on your project  From the Lint Warnings view, use the toolbar options to configure lint preferences for individual projects and files in Eclipse. 45

46  Project and file-specific preferences  Suppress this error with an annotation/attribute If the issue appears in a Java class, the lint tool adds a @SuppressLint annotation to the method where the issue was detected. If the issue appears in an.xml file, lint inserts a tools:ignore attribute to disable checking for the lint issue in this file.  Ignore in this file Disables checking for this lint issue in this file.  Ignore in this project Disables checking for this lint issue in this project.  Always ignore Disables checking for this lint issue globally for all projects. 46

47  Annotation  Toast created but not shown: did you forget to call show() ?  Attribute  [I18N] Hardcoded string "OK", should use @string resource 47 @SuppressLint("ShowToast") @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toast.makeText(this, "Sample toast message", Toast.LENGTH_SHORT); } <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="OK" tools:ignore="HardcodedText" >

48

49  Android Device Monitor is a stand-alone tool that provides a graphical user interface for several Android application debugging and analysis tools.  /tools/monitor  DDMS  Traceview  HierarchyViewer  Tracer for OpenGL ES  Systrace 49

50 50

51  Android ships with a debugging tool called the Dalvik Debug Monitor Server (DDMS), which provides port- forwarding services, screen capture on the device, thread and heap information on the device, logcat, process, and radio state information, incoming call and SMS spoofing, location data spoofing, and more. 51

52 52

53  Traceview is a graphical viewer for execution logs saved by your application.  Traceview can help you debug your application and profile its performance. 53

54  Creating Trace Files  Include the Debug class in your code and call its methods to start and stop logging of trace information to disk.  Use the method profiling feature of DDMS to generate trace logs.  Traceview in DDMS  After you select a specific process, you can click on the Start Method Profiling icon, and then click again to stop profiling. 54

55  Describes when each thread and method started and stopped. 55

56  Provides a summary of what happened inside a method. 56

57  Name: the name of the method  Incl %: the percentage of time spent in that method (including children methods)  Inclusive: the time in milliseconds spent in that method (including children methods)  Excl %: the percentage of time spent in that method (excluding children methods) 57

58  Exclusive: the time in milliseconds spent in that method (excluding children methods)  Calls+RecurCalls/Total: the number of calls and recursive calls  Time/Call: the average time per call in milliseconds 58

59  Hierarchy Viewer allows you to debug and optimize your user interface.  It provides a visual representation of the layout's View hierarchy (the Layout View). 59

60 1.Connect your device or launch an emulator. To preserve security, Hierarchy Viewer can only connect to devices running a developer version of the Android system. 2.If you have not done so already, install the application you want to work with. 3.Run the application, and ensure that its UI is visible. 4.From a terminal, launch hierarchyviewer from the /tools/ directory. 60

61 61

62 5.The first window you see displays a list of devices and emulators. To expand the list of Activity objects for a device or emulator, click the arrow on the left. This displays a list of the Activity objects whose UI is currently visible on the device or emulator. The objects are listed by their Android component name. The list includes both your application Activity and system Activity objects. 6.Select the name of your Activity from the list. You can now look at its view hierarchy using the View Hierarchy window. 62

63 63

64  Tree View  The left-hand pane displays the Tree View, a diagram of the Activity object's hierarchy of views. Use Tree View to examine individual View objects and see the relationships between View objects in your UI.  Tree Overview  The upper right-hand pane displays the Tree Overview, a smaller map representation of the entire Tree View window. Use Tree Overview to identify the part of the view tree that is being displayed in Tree View.  Properties View  The middle right-hand pane displays the Properties View, a list of the properties for a selected View object. With Properties View, you can examine all the properties without having to look at your application source. 64

65  Layout View  The lower right-hand pane displays the Layout View, a block representation of the UI. Layout View is another way to navigate through your UI. When you click on a View object in Tree View, its position in the UI is highlighted. Conversely, when you click in an area of Layout View, the View object for that area is highlighted in Tree View.  The outline colors of blocks in Layout View provide additional information: Bold red: The block represents the View that is currently selected in Tree View. Light red: The block represents the parent of the block outlined in bold red. White: The block represents a visible View that is not a parent or child of the View that is currently selected in Tree View. 65

66 66

67  View class  The View object's class.  View object address  A pointer to View object.  View object ID  The value of the android:id attribute.  Performance indicators  A set of three colored dots that indicate the rendering speed of this View relative to other View objects in the tree. The three dots represent (from left to right) the measure, layout, and draw times of the rendering.  View index  The zero-based index of the View in its parent View. If it is the only child, this is 0. 67

68  When you select a node, additional information for the View appears in a small window above the node  Image: The actual image of the View, as it would appear in the emulator. If the View has children, these are also displayed.  View count: The number of View objects represented by this node. This includes the View itself and a count of its children. For example, this value is 4 for a View that has 3 children.  Render times: The actual measure, layout, and draw times for the View rendering, in milliseconds. These represent the same values as the performance indicators mentioned in the preceding section. 68

69  Analyzing OpenGL for Embedded Systems (ES) code in your Android application.  The tool allows you to capture OpenGL ES commands and frame by frame images to help you understand how your graphics commands are being executed.  Minimum Requirements  A device running Android 4.1 (API Level 16) or higher. 69

70  To run Tracer in Eclipse  Start Eclipse and open a workspace that contains an Android project.  Activate the perspective for Tracer by choosing Window > Open Perspective > Other...  Select Tracer for OpenGL ES and click OK.  To run Tracer in Device Monitor  Start the Device Monitor tool.  Activate the perspective for Tracer by choosing Window > Open Perspective...  Select Tracer for OpenGL ES and click OK. 70

71 1.Connect the Android device using a USB cable and make sure it is enabled for debugging. 2.In Eclipse or Device Monitor, activate the Tracer for OpenGL ES perspective. 3.On the toolbar, click the trace capture button. 71

72 4.In the dialog box, select the Device to use for the trace. 5.In the Application Package field, enter the full application package name containing the activity you want to trace, for example: com.android.settings 72

73 6.In the Activity to launch field, enter the class name of the activity you want to trace, for example: OpenGLES20Complete 7.Select the desired Data Collection Options. Note: If you want to capture progressive frame images for each drawing call, enable the Read back currently bound framebuffer on glDraw*() option. Be aware that using this option can result in large trace files. 8.Enter a Destination File for the trace output. 73

74 9.Click Trace to start the trace capture. 10.On the connected device, exercise the functions of your application you want to trace. 11.In the dialog box, Stop Tracing to complete the tracing run. 74

75  To review a captured trace: 1.In Eclipse or Device Monitor, activate the Tracer for OpenGL ES perspective. 2.On the toolbar, click the trace load button. 3.After loading a trace, select a frame and review the OpenGL ES calls. Drawing commands are highlighted in blue. 75

76 76

77  Very low-level tracing tool.  /tools/systrace/systrace.py  Minimum Requirements  A device running Android 4.1 (API Level 16) or higher.  Generating Traces  Use the --set-tags option to configuring trace data categories $> python systrace.py --set-tags=gfx,view,wm  Stop and restart the adb shell to enable tracing of these processes. $> adb shell stop $> adb shell start  Running a trace $> python systrace.py --cpu-freq --cpu-load --time=10 -o mytracefile.html 77

78 78

79

80  What's New in Android Developers’ Tools (Google I/O 2012) (https://developers.google.com/events/io/sessions/gooio2012/104)https://developers.google.com/events/io/sessions/gooio2012/104  Android Developers (http://developer.android.com)http://developer.android.com  Android Tools Project Site (http://tools.android.com)http://tools.android.com 80


Download ppt "사업 1 본부 모바일기술연구소 연구 1 실 연구 2 팀 이현상 주임연구원. 2 Emulator 01. Application Templates 02. XML Editing 03. Lint 05. Layout Editor 04. Debugging Tools 06."

Similar presentations


Ads by Google