Sunteți pe pagina 1din 32

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 to help you download, install and setup your system we highly recommend you viewing the videos to understand the process fully. The installation guide combines the installation and configuring 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.

Go to the Java website: http://www.oracle.com/technetwork/java/javase/downloads/jdk7downloads-1880260.html#jdk-7u45-oth-JPR

Choose the correct version for your system. You need to select the same bit version as you select when downloading the ADT bundle (IMPORTANT To avoid any problems, please make sure you download the version of the JDK that matches your Android SDK. The Java website uses slightly different terminology if you need the 32-bit version, select the x86 version of Java that is suitable for your operating system. If you have the 64-bit version of the SDK, you need the 64-bit version of the JDK.)

The downloaded JDK file is an executable file. So when you double click on the file it should start installing. You may be presented with a security control dialog asking whether you want to install the JDK, accepting this will take you through the installation. (IMPORTANT: We noticed some of our participants, from the first run of the course, who tried to download 64bit JDK complained that the downloaded file did not execute when double-clicked. It was seen that the file extension .exe part at the end was missing. For some reason the file extension gets stripped off. Simply re-add the extension .exe to the end of the filename and it should let you run the installation. Note. You might need to set up the computer to show file extensions first. For this from any explorer window click on the view tab and check the file name extensions tick box.)

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.

Find the version of the ADT bundle 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 is a version of the SDK with the integrated development environment (IDE) included. After clicking on the link to download the software, you will be presented with Terms and Conditions of the license agreement. If you agree to these terms, tick the box to confirm, and 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.

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

Now follow the steps on the page to set up the software.

You may find these video guides helpful in guiding you through the process: INSTALLING THE ANDROID SDK IN WINDOWS 8 INSTALLING THE ANDROID SDK IN WINDOWS 7

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 youre 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. IMPORTANT: The Android SDK bundle comes as a compressed file that is a Zipped file. So before you can use this it needs to be uncompressed (that is unzipped, extract or unpack).

Cant 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, but if not you may find this Wikipedia article useful. 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. Still having trouble? Unzipping files on Windows platforms is explained in this blog post http://openeducationmooc.blogspot.co.uk/2013/11/flmobigame-unzipping-files-onwindows.html

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. Cant 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. Still having trouble? Unzipping files on Windows platforms is explained in this blog post http://openeducationmooc.blogspot.co.uk/2013/11/flmobigame-unzipping-files-onwindows.html

Open Eclipse: Double-click on the ADT bundle youve 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 6) and double-click it. When you run eclipse, it will prompt a security message (Figure 7).

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 8).

Select a Workspace After that you will be prompted with a screen like this (Figure 9).

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 10).

Now close this welcome and you will see a screen similar to Figure 11.

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 12)

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 14)

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 15).

This will open the Android Virtual Device Manager (Figure 16).

To create a new virtual device (also called an emulator) click New. This will open Create new Android Virtual Device dialog (Figure 14).

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 28).

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 (CTRL + A in Windows) and copy it to clipboard (CTRL+C in Windows). 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. Lets 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 be 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 lets 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 1.12. 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.

S-ar putea să vă placă și