This document provides an overview of Android Studio and instructions for creating a basic Android app. It discusses setting up the development environment, the key components of Android Studio like the interface, build variants and layout previewer. It also explains the project structure for an Android app and how to define resources like colors, dimensions and strings. The document concludes with steps to build a simple app with a linear layout and instructions to launch it on a device.
3. Environment
JDK
– Download JDK (or from Oracle)
– Installation and Environment Variable Settings
JAVA_HOME
PATH
Installation result on cmd
Android SDK and Studio
– Download Android SDK and Studio (or from Android Developer)
– Installation
Launch the .exe file you just downloaded
Follow the setup wizard
4. Android SDK
Platform-tools folder
– Adb(Android Debug Bridge) instructions
devices: Prints a list of all attached emulator/device instances.
logcat: Prints log data to the screen.
push: Copies a specified file from an emulator/device instance to your
development computer
pull: Copies a specified file from your development computer to an
emulator/device instance.
Tools folder
Android
– avd: Launch the AVD Manager
– sdk: Launch the Android SDK Manager
11. Android Studio Overview
Features
– Flexible Gradle-based build system
– Build variants and multiple apk file generation
– Code templates to help you build common app features
– Rich layout editor with support for drag and drop theme editing
– lint tools to catch performance, usability, version compatibility, and
other problems
– And much more
12. Android Studio Overview
Details
– Auto Complete
– Build Variants
– Productivity Guild
– Multi Devices Debug
– Layout Preview for Multi Devices
– Plugins
– Code Template
– Layout Tools Attributes
– Resource Preview
– And much more
13. Android Studio Overview
Details
– Auto Complete
– Build Variants
– Productivity Guild
– Multi Devices Debug
– Layout Preview for Multi Devices
– Plugins
– Code Template
– Layout Tools Attributes
– Resource Preview
– And much more
14. Android Studio Overview
Details
– Auto Complete
– Build Variants
– Productivity Guild
– Multi Devices Debug
– Layout Preview for Multi Devices
– Plugins
– Code Template
– Layout Tools Attributes
– Resource Preview
– And much more
15. Android Studio Overview
Details
– Auto Complete
– Build Variants
– Productivity Guild
– Multi Devices Debug
– Layout Preview for Multi Devices
– Plugins
– Code Template
– Layout Tools Attributes
– Resource Preview
– And much more
16. Android Studio Overview
Details
– Auto Complete
– Build Variants
– Productivity Guild
– Multi Devices Debug
– Layout Preview for Multi Devices
– Plugins
– Code Template
– Layout Tools Attributes
– Resource Preview
– And much more
17. Android Studio Overview
Details
– Auto Complete
– Build Variants
– Productivity Guild
– Multi Devices Debug
– Layout Preview for Multi Devices
– Plugins
– Code Template
– Layout Tools Attributes
– Resource Preview
– And much more
18. Android Studio Overview
Details
– Auto Complete
– Build Variants
– Productivity Guild
– Multi Devices Debug
– Layout Preview for Multi Devices
– Plugins
– Code Template
– Layout Tools Attributes
– Resource Preview
– And much more
19. Android Studio Overview
Details
– Auto Complete
– Build Variants
– Productivity Guild
– Multi Devices Debug
– Layout Preview for Multi Devices
– Plugins
– Code Template
– Layout Tools Attributes
– Resource Preview
– And much more
20. Android Studio Overview
Details
– Auto Complete
– Build Variants
– Productivity Guild
– Multi Devices Debug
– Layout Preview for Multi Devices
– Plugins
– Code Template
– Layout Tools Attributes
– Resource Preview
– And much more
21. Android Studio Overview
Details
– Auto Complete
– Build Variants
– Productivity Guild
– Multi Devices Debug
– Layout Preview for Multi Devices
– Plugins
– Code Template
– Layout Tools Attributes
– Resource Preview
– And much more
22. Android Studio Overview
Details
– Auto Complete
– Build Variants
– Productivity Guild
– Multi Devices Debug
– Layout Preview for Multi Devices
– Plugins
– Code Template
– Layout Tools Attributes
– Resource Preview
– And much more
24. Resources
Drawable
– A drawable resource is a general concept for a graphic that can be
drawn to the scree.
values
– strings: A string resource provides text strings for your application with
optional text styling and formatting.
– colors: A ColorStateList is an object you can define in XML that you can
apply as a color, but will actually change colors, depending on the state of
the View object to which it is applied.
– styles: A style resource defines the format and look for a UI.
– dimens: A dimension is specified with a number followed by a unit of
measure.
25. App Manifest
Manifest file
– The manifest file presents essential information about your app to the
Android system, information the system must have before it can run
any of the app's code.
Permission
– A basic Android application has no permissions associated with it by
default, meaning it cannot do anything that would adversely impact
the user experience or any data on the device.
– To make use of protected features of the device, you must include in
your AndroidManifest.xml one or more <uses-permission> tags
declaring the permissions that your application needs.
31. Dimens
Suggestions
– Because it's important that you design and implement your layouts for
multiple densities, the guidelines below and throught the
documentation refer to layout dimensions with dp measurements
instead of pixels.
– Similarly, you should prefer the sp (scale-independent pixel) to define
text sizes. The sp scale factor depends on a user setting and the system
scales the size the same as it does for dp.
34. The First Android App
Create a new project
– Empty project
Define resources that you need
– Colors.xml, dimens.xml, strings.xml, styles.xml, drawable
Prepare Layout files
– Add Android Resource Directory named layout within res folder
– Add a layout.xml
LinearLayout
35. The First Android App
Bind the above files with your java files
– Activity
SetContentView()
FindViewById()
Define App Manifest file
– Intent
– Intent-filter
Launch your App in a device