Open main menu

CDOT Wiki β

Changes

MAP524/DPS924 Lab 1

2,820 bytes added, 14:19, 3 October 2015
Part D: Submit
= Lab 1: Build an Android App with Gradle =
 
Due: in the lab period, need professor sign-off.
== Part A: Setting up Android Studio on Linux ==
<li>Before you move on to PART C, try "gradle --help" to see what else gradle can do. If the build was successful you can run the Bash tree command to get a bird's eye view of what files/directories were created by the build. Save this tree output, you'll need it for PART D of this lab.</li>
</ol>
 
== Part C: Start an Android Virtual Device (AVD) and install your app. ==
 
<ol>
<li>Use this comand to list your virtual devices:</li>
<pre>android list avd</pre>
<li>If you used the default settings when setting up Android Studio - you should have one AVD already. You can now start your AVD with this command: </li>
<pre>emulator -avd Nexus_5_API_22_x86 &</pre>
<li>If your AVD is too large on the screen you can use the scale option to make it smaller, like this:</li>
<pre>emulator -scale 0.4 -avd Nexus_5_API_22_x86</pre>
<li>Finally, we can install our APK onto our AVD with this command: </li>
<pre>adb install build/outputs/apk/GradleProject-debug.apk</pre>
<li>Now that our app is installed, we should be able to run it. Click on the app icon in the AVD to execute it.
<li>Modify your app by editing your HelloActivity.java file and change the text to be displayed to "Hello my name is Andrew Smith". You'll find your HelloActivity.java inside your project's java/org/hello folder.</li>
<li>Back in your apps project directory rebuild your app as in step B7.</li>
<li>Try to install the app using the adb command as in step C4. You should get an error message telling you that the app is already installed.</li>
<li>Use this adb command to connect to your AVD:</li>
<pre>adb shell</pre>
<li>Now that you have a shell on the AVD you can list all installed packages using the pm command like this </li>
<pre>pm list packages</pre>
<li>Use the pm command to remove your app. You'll have to use the full package name like this </li>
<pre>pm uninstall org.hello</pre>
<li>Exit the debug shell with the "exit" command or Ctrl+d.</li>
<li>You can now repeat step C4 to install your package.</li>
<li>Run your app to ensure it says "Hello my name is Andrew Smith" (but use your own name).</li>
<li>Now take a screen shot of your running app with this command </li>
<pre>screenshot2 -e lab01.png</pre>
<li>You can view the image file by using the Linux "display" command.</li>
<li>When satisfied with using Android command line tools please move on to PART D of this lab. </li>
</ol>
 
== Part D: Wiki Account ==
 
Send an email to cdot-wiki-admin@senecacollege.ca asking that you have an account created for you on the wiki.
 
== Part E: Submit ==
 
Make notes about what you learned in your labbook. Remember you can take your labbook with you to the test and exam, so write information in there that will help you answer questions related to this week's material.
 
When you're done - call me over and I will:
 
* Check your labbok for notes.
* Ask you some questions to make sure you understood the material this week.
* Look at your GradleProject files.
* See your GradleProject running in the emulator (or a real phone).
* Sign the front of your labbook for this lab.