Preview only show first 10 pages with watermark. For full document please download

Rdg Document Template

   EMBED


Share

Transcript

Please note that this is a working document and that errors may remain. There are lot of things that are discussed in the videos that are not discussed here. This installation guide is only help you download, install and setup your system – we highly recommend you viewing the videos to understand the process fully. The installation guide combines installation and configuration instructions from several MOOC resources without going into detail about other features discussed in videos. IMPORTANT: The order in which you install Java JDK and Android SDK does not matter as long as you correctly install them for the same bit version. NOTE: If you have the latest version of Ubuntu, you do not need to install Java JDK. Ubuntu comes with Open JDK and it is sufficient for this work. If you have the latest version of Ubuntu you can directly proceed to ‘Downloading and installing the SDK’. NOTE: The screenshots in the last 3 steps are from a Windows operating system. There may be some aesthetic differences; however, the steps are identical. To download the Java JDK, go to the Java website: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads1880260.html#jdk-7u45-oth-JPR Choose and download the correct version for your system. The downloaded JDK file should then be installed in your machine. You may be presented with a security control dialog asking whether you want to install the JDK. You may find this video helpful in guiding you through the process:  INSTALLING THE ANDROID SDK IN UBUNTU LINUX As we learnt in the ‘Welcome to week 1’ video, we will need to set up some specific software to be able to view, edit and modify the code. Follow the steps below to download the right software for your system. Visit the Android developers’ site (http://developer.android.com/sdk/index.html) on the device you wish to install the software to. Scroll to the bottom of the page and click ‘DOWNLOAD FOR OTHER PLATFORMS’. This will display a table of download links for different platforms. Find the version of the SDK (Software Development Kit) that matches your system and click the link in the ‘Package’ column. Do not select any of the ‘SDK Tools only’ versions – the ADT bundle (Android Developer Tools) is a version of the SDK with the integrated development environment (IDE) included. After clicking on the link to download the software, you may be presented with Terms and Conditions of the license agreement. If you agree to these terms, tick the box to confirm then click the blue download button. Please note: The package of files is quite large (approximately 450MB), so please get permission from the person who pays the bill for your internet connection before you download. (IMPORTANT – To avoid any problems, please make sure you download the version of the JDK that matches your Android SDK) The downloaded file is zipped file. So you need to extract (unzip it). Select the downloaded file and right-click on it. From the pop-up menu select ‘Open with Archive Manager’. Select the file in Archive Manager and right-click. From the pop-up menu select ‘Extract’. In the Extract dialog select Desktop as the location and select Extract All Files. Click Extract. Now the files will be extracted to Desktop. Should you need, the Android developers’ website has instructions on how to install the software bundle. Visit the installation page on the Android developers’ site: http://developer.android.com/sdk/installing/bundle.html You may also find this video helpful in guiding you through the process:  INSTALLING THE ANDROID SDK IN UBUNTU LINUX You may need administrator permissions on your computer to complete this step. If you do not have administrator permissions on the machine you are installing the software to (for example if it belongs to your work or school) you may need to ask the administrator to do this for you. If you’re having problems, please post a comment. The course staff and helpers will do their best to help. If you have tips for other users, please share your knowledge. NOTE: Some participants complained that when trying to unzip the package they were asked for passwords. If this happens to you try downloading the bundle again and using a different software to unzip the bundle. The game framework is the code that will form the skeleton of the game you will be developing. By exploring and editing this framework you will learn about some of the different elements that make up a program and how you can use these to write your own code. Download the game framework following the link in the step. The downloaded game framework is in a compressed (zip) file. So you need to unzip the bundle before doing anything else. Can’t open the .zip file? To install the software, you will need a program that can open .zip files. You may already have this software installed which you can use. If you want to download and install a free tool for zip/unzip you can use http://www.izarc.org/ or http://www.7-zip.org/ NOTE: Some participants complained that when trying to unzip the package they were asked for passwords. If this happens to you try downloading the bundle again and using a different software to unzip the bundle. 7-Zip users seem to have got on without trouble so you may want to try that. Open Eclipse: Double-click on the ADT bundle you’ve downloaded and unzipped into your computer. When you open up this folder this will be inside Now double-click on the eclipse folder to go inside. Locate the eclipse executable file (highlighted in Figure 13) and double-click it. When you run eclipse, it will prompt a security message (Figure 14). Un-check the check box ‘Always ask before opening this file’ and click ‘Run’ to open eclipse. Now it will show you a splash screen (Figure 15). Select a Workspace After that you will be prompted with a screen like this (Figure 16). The workspace is where you will be creating your programmes. This is a folder in your computer. Click ‘OK’. It will take a little bit of time to configure everything required and then will present a screen similar to this (Figure 17). Now close this welcome and you will see a screen similar to Figure 18. Open Android SDK Manager: To make sure your IDE is correctly setup first click on Android SDK Manager icon on the tool bar (highlighted in Figure 19) This will start up the Android SDK Manager. It could take a little time to open and once it opens you can see the Android SDK Manager (Figure 21) If you did not manage to get Android SDK Manager window it is likely that you have a problem with your Java. It is possible you are running the wrong version of Java – say 64 bit version when you should have 32 bit or wise versa. Also you need to make sure (as said before) you have got both ADT bundle and Java SDK both, and they are compatible (both 32 bit or both 64 bit). Now close the Android SDK Manager window using top close button. Open Android Virtual Device Manager: Next we will be testing the Virtual Device Manager. Click on the Android Virtual Device Manager icon (Figure 22). This will open the Android Virtual Device Manager (Figure 23). To create a new virtual device (also called an emulator) click ‘New’. This will open Create new Android Virtual Device dialog (Figure 24). On ‘AVD Name’ give a name to it. We are calling it ‘test’ Now click on the down arrow on ‘Device’ and you will see a drop-down list of devices. Select a device with low specification. Leave all other options as they are and click ‘OK’ Now on the Android Virtual Device Manager you can see the newly created virtual device. Start Android Virtual Device (or Emulator): Click on the virtual device you created and click ‘Start’. Now click ‘Launch’. It will take quite a bit of time to launch the virtual device, as long as 10-15 minutes. So we suggest at this point you go and get yourself a cup of tea (or coffee) and perhaps a sandwich too  Once the virtual device (emulator) is launched it will look something like this. But it may look slightly different, depending which device you have chosen. Click the blue ‘OK’ button. Because it takes ages to load up it would be a good idea to minimize your emulator and keep it running rather than closing and re-launching. Close the Android Virtual Device Manager. NOTE: If you leave your Emulator without interacting with it for a while the screen locks itself similar to an Android phone. Locked screen will have a closed padlock (Figure 35). If this happens you need to click on the padlock and drag outward until it opens. Right click on the package explorer and select ‘Import’. In the Import dialog click the triangle next to the Android folder to open up the options. Select ‘Existing Android Code Into Workspace’ and click Next. In the next dialog select ‘Browse’ and locate the downloaded and unzipped game framework. Select the ‘uk.ac.reading.sis05kol.mooc’ folder and select ‘OK’ Now select ‘Copy projects into Workspace’ check box and click ‘Finish’. After the import, the package explorer will look similar to this. There is a warning displayed, this is not a problem and we will leave it as it is. Run the Game: Click on the ‘MainActivity’ on the package explorer. Now right-click on it. Select ‘Run As’ from the menu and then select ‘Android Application’ Click on the emulator to bring it forward. It may take some time for the game to appear. When you run the game for the first time Auto Monitor Logcat Dialog will appear. Click ‘OK’. Initially the emulator screen will look similar to this. Now click on it. Get the Game for Week 1: Go into ‘TheGame versions’ folder inside ‘workspace-MOOC’ folder – this is the folder containing the game framework you downloaded and unzipped on your computer. Right-click on the v1 file and open it with a text editor. Here we are using Notepad ++ (it is a free software that can be downloaded from http://notepad-plus-plus.org/). Select all of its text and copy it to clipboard. Then go to the project. The contents of the file v1.java needs to be copied to TheGame.java file located in the ‘src’ folder. Now select all from this file and delete it then past the copied content to this file. Now we have Week 1 code in our TheGame.java file you can save the project. Let’s run the project. As we previously did, bring the emulator to foreground. Clicking on the screen will bring a red ball to the screen. You will notice not much is happening right now.... Comments At this point we will introducing you to ‘comments’ in coding. Comments are used to describe complex logic in a program or source code to improve human readability. Comments are ignored by the computer when executing the code. However, if you go down on TheGame.java file in the project you can see there is a lot of code (shown highlighted in the figure) that is in green colour. In this text editor comments are shown in green. Actually what we have done here is “commenting out” some of the code we have written in the game and that is why the instructions are ignored by the computer. Hence nothing happens in the game. Now let us “un-comment” this block of instructions to see what happens. Concentrate on the two blocks of code ‘actionOnTouch’ and ‘actionWhenPhoneMoved’ in the ‘TheGame.java’ file. To run the code in emulator we need to remove the /* and */ symbols that are placed between ‘actionOnTouch’ block. If you are running it on the phone /* and */ symbols that are placed between ‘actionWhenPhoneMoved’ should be removed. We will learn about comments later but what happens when you use /* and */ is that anything placed between these two sets of symbols is considered a comment. So because ‘actionOnTouch’ is between the opening (/*) and closing (*/) comments symbols the computer completely ignores what it should do when ‘actionOnTouch’ happens. Now that we know a bit about comments let’s un-comment this block. For that delete the highlighted bits from the file. Did you notice that the colour of the text changed from being green? Now run the project again (just like you did before) and see what the difference is. Now it will respond when you click on the screen! Renaming a Project: Right-click on package explorer window ‘MainActivity’ and select ‘Refactor’ ‘Rename’ Type ‘uk.ac.reading.sis05kol.mooc’ as the new name. If you have reached this point successfully that means you have fully setup your working environment and you are ready for Week 2. If you have an Android phone or tablet you could try installing the game into it using the guide we have provided in the last step. However, if this import did not work for you please view the video to see how we can do this process manually. There is also an alternative method and video located in the course notices. If you are still having difficulty, please post a comment and we will try and help.