Open main menu

CDOT Wiki β

Changes

MAP524/DPS924 Lab 2

556 bytes added, 16:27, 16 January 2016
Part A: Creating your First Android Studio Project
= Lab2: First App with Android Studio =
 
Due: in the lab period, need professor sign-off.
For this and all following labs you will need your USB memory stick from lab 01 or use your own Linux/Windows/Mac system.
* For the App name enter "MAP524 Lab 2" or "DPS924 Lab 2".
* You can now create a default Android Studio app with just a few clicks of the mouse. All the code will be automatically generated. Click Next.
* On the next screen you can set the Minimum SDK to API 15 for Phone and Tablet. Do not set up anything for TV, Wear or Glass. That will come later. Click Next twice then click Finish.
* Your app should now be successfully built by Gradle.
* Now you can create an AVD using the AVD Manager. Create an AVD for the Nexus4 Nexus5 phone. The target and Platform should be Android 4.4.2Marshmallow, API level 1923. The CPU/ABi ABI should be x86x86_64. Set your AVD scaling ** You will need to "2 pixels on device = 1 pixel on screen" - this will make your AVD half sizedownload the emulator image if you haven't done that earlier.* You can now start your AVD. The first time you run it - it will take longer to start, that's normal.* Take a screenshot of the AVD by first bringing up the using Android DDMS window pane and then clicking on Monitor. Once you select your device the camera iconwill be enabled. Note: if Notice how much larger the image screenshot is all black then edit your AVD and disable GPU acceleration and take a second screenshot. This time it should workthan the emulator screen.Why is that?
* Finally, install and run your app by clicking the "Run" icon on the top tool bar. NOTE: The first time you run you'll notice that Gradle and a few other components of Android Studio may be updated by automatic downloads of newer versions.
* When your app runs correctly make the following modifications to it:
When satisfied with using Android Studio to build a default app, please move on to PART B of this lab.
== Part B: Gradle == Gradle is a build tool. It replaced Ant and Make for Android projects when the move from Eclipse to Android Studio happened. It's very complex but we'll need to know some basics at least. If you switch your project view to "Project" from "Android" you'll find there are two build.gradle files. We'll mostly be working with the one in the "app" subdirectory. === SDK Versions === There's compileSdkVersion, minSdkVersion, and targetSdkVersion. Set them all to different versions and try to run your app on emulators with different versions. Record what you've found in your labbook. '''Be careful not to run out of space''' on your USB stick, the SDKs take up quite a bit of room. == Part C: Move your app to GitHub ==
* If you do not have a github account please make one now.
* Once your project is correctly placed onto github, please move onto part C.
== Part CD: Answer the following questions in your labbook ==
* What's the purpose of the three SDK Version paramaters in build.gradle files?
* What is the URL of your github account?
* Explain '''in your own words''' what is meant by each of these Android Studio terms or phrases:
*# project
*# panel
*# toolbar
*# status bar
*# preview pane
*# android pane
*# project explorer
*# .idea folder
*# intellisense
*# module
*# live layout
* Explain each GIT term in your own words using one or two short sentences (on Linux use the command "man git" for help, but better yet find a simple Git tutorial online):
*# init
*# add
*# pull
*# branch
*# clone
* Show your work to the professor in the lab and get him to sign off on your labbook.