18
Developing Android applications in Windows Below you will find information about the components needed for developing Android applications and other (optional) software needed to connect to the institution’s resources. A small description on how to connect and install the HaptiMap Toolkit is also attached. Step 1 Install the JDK6 If you don’t have the JDK, you will need to install it. 1. Go to http://www.oracle.com/technetwork/java/javase/downloads 2. Accept the License Agreement and choose your platform to Continue (Please make sure you are downloading JDK and not JRE and check if your OS is x86 or x64) 3. Follow the instructions for a default installation Registration optional! Note: If you choose a 64 bit version, you might need to add the Java directory to the path. First create a windows environment variable called JAVA_PATH pointing to C:\Program Files\Java\jdk1.6.0_xx (xx being your version number). Then prefix your Path variable with %JAVA_PATH%\bin Step 2 Eclipse IDE Classic 3.6.2 or greater Install or update Eclipse if needed. 1. Go to http://www.eclipse.org/downloads/ We recommend you to download Eclipse Classic (current version is 4.2.1) 2. Extract files and put in folder c:\eclipse (NOT c:\eclipse\eclipse!) No installation is needed. Note: It seems to be a problem with Android and Eclipse after a fresh installation. The issue is because of the Java JDK compliance. If you find the following error message:

Developing Android applications in Windows

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Developing Android applications in Windows

Developing Android applications in Windows

Below you will find information about the components needed for developing Android

applications and other (optional) software needed to connect to the institution’s resources. A

small description on how to connect and install the HaptiMap Toolkit is also attached.

Step 1 Install the JDK6

If you don’t have the JDK, you will need to install it.

1. Go to http://www.oracle.com/technetwork/java/javase/downloads

2. Accept the License Agreement and choose your platform to Continue (Please make sure you are downloading JDK and not JRE and check if your OS is x86 or x64)

3. Follow the instructions for a default installation

Registration optional!

Note: If you choose a 64 bit version, you might need to add the Java directory to

the path. First create a windows environment variable called JAVA_PATH

pointing to C:\Program Files\Java\jdk1.6.0_xx (xx being your version number).

Then prefix your Path variable with %JAVA_PATH%\bin

Step 2 Eclipse IDE Classic 3.6.2 or greater

Install or update Eclipse if needed.

1. Go to http://www.eclipse.org/downloads/ We recommend you to download Eclipse Classic (current version is 4.2.1)

2. Extract files and put in folder c:\eclipse (NOT c:\eclipse\eclipse!) No installation is needed.

Note: It seems to be a problem with Android and Eclipse after a fresh

installation. The issue is because of the Java JDK compliance. If you find the

following error message:

Page 2: Developing Android applications in Windows

Android requires compiler compliance level 5.0 or 6.0. Found '1.4' instead. Please use Android Tools > Fix Project Properties.

Then, from Eclipse

1. Go to Window -> Preferences. 2. On the left panel select Java -> Compiler and change to level 1.6

If the level is 1.6, select another level, apply and change back to 1.6.

Step 3 Download and Install Android SDK

Install or update SKD if needed.

1. Go to http://developer.android.com/sdk and download the current package We recommend to download the zip file and extract to your local drive

2. Follow up by downloading and extracting the current Android SDK files to your local drive (c:\android-sdk-windows) If you choose the installer package, remember the location where it is installed.If the installer fails, please use the zip version that is available on the same link.

3. If you used the zip package, go to c:\android-sdk-windows and start the “SDK Manager” If you used the installer, Go the start menu and start the SDK Manager.

4. Make sure that the desired Android version is selected. You need at least

ONE platform. We recommend that you choose version 2.3.3. The versions installed in the devices from the department can vary. If your intention is to use your private device, please make sure you install a supported version for your device.

i. Select the latest SDK Platform-tools

ii. Select the USB Driver for Windows which will be needed to connect the

mobile phone to the developer’s computer

iii. (Optional) There are some samples available for the different versions. Select a suitable one that you can use to learn about Android and for further reference

Page 3: Developing Android applications in Windows

iv. (Optional) If you would like to use Google Maps, then you will need to install the Google API.

5. Install to continue

Note: The Android 4.0 is a major platform release and is highlighted every time

the SDK is launched. There are some dependencies that need to be solved and

Page 4: Developing Android applications in Windows

additional packages need to be downloaded. We have little experience with this

release as of yet.

Step 4 Download and Install ADT Plugin for Eclipse

If you have a fresh copy of Eclipse or if you are running an older version of the

ADT Plugin and recently updated the SDK, then you will need to install or

update the ADT Plugin.

1. Start Eclipse and go to http://developer.android.com/sdk/installing/installing-adt.html and follow the instructions

2. You will need at least the “Android Development Tools” although we

recommend selecting all available tools in the repository

3. Restart Eclipse and go to Window -> preferences and select Android

Page 5: Developing Android applications in Windows

4. Browse to the SDK location and click OK

5. There is also a video on how to achieve this at http://www.xtensivearts.com/2009/07/03/episode-1-getting-started

The video is old but it gives the basics for the installation. Note: It might take some time to install the Plugin

Step 5 The Hello World App and Create an AVD

When the dev environment is completed, follow the steps in the “Hello World”

tutorial which also guides you to set up the Android emulator.

1. Go to http://developer.android.com/training/basics/firstapp/creating-project.html and follow the instructions.

Page 6: Developing Android applications in Windows

2. Run the application and make sure it runs (at least) on the Android 2.3.3 http://developer.android.com/training/basics/firstapp/running-app.html#Emulator

The AVD Manager is located in the same directory as your SDK Manager.

There are other tools that might be of interest in the android-sdk-windows\tools

such as the DDMS. Run in and find out more.

Step 6 Connect your mobile

The “Hello World” runs fine on an emulator and with this step you’ll be ready to

use a regular device to upload and run applications on it.

1. Go to http://developer.android.com/tools/device.html and follow instructions

2. Upload your “Hello World” application and see if you can find out anything else about the Activity you are running

Step 7 Subversive (SVN) plugin for Eclipse

A simple way to share code between other project members is by using a

collaboration tool which supports revision control. Eclipse comes with a default

cvs client, which is not supported in our department.

More about Subversion (SVN):

http://subversion.tigris.org/

http://en.wikipedia.org/wiki/Apache_Subversion

Subversive consists of two parts: Subversive Plug-in and Subversive SVN

Connector.

You must install both.

1. Go to Help -> Install New Software

2. Choose --All Available Sites-- and type svn or subversive

3. Choose “Subversive SVN Team Provider” and follow the installation instructions.

4. Restart eclipse.

Page 7: Developing Android applications in Windows

After restart, you will need to install the Connector

5. A pop-up should appear when Eclipse restarts. Select the “SVNKit 1.3.8 Implementation” and “Finish”

Page 8: Developing Android applications in Windows

6. Then the following screen appears, both the Connectors and the SVNKit

should be selected. Select “Next” and follow the instructions. A license needs to be approved and Eclipse needs to be restarted.

Page 9: Developing Android applications in Windows

Step 8 Share Project

In order to let the other project members to update and commit changes to a

project, we need to share it.

1. Highlight your Hello World Project and right click. Select Team -> Share Project

2. Select SVN and Next

3. At the URL for repository location information, type in http://certec-svn.design.lth.se/svn/demo and type in User: demo Password: aid2011

Page 10: Developing Android applications in Windows

Note: Next time you want to share a project, the credentials for the “demo” login will be stored automatically. For the real project, you need to use the login and password that will be attributed to your group. To force subversive to forget the stored credentials first close Eclipse. You can then erase the “secure_storage” file that has just been stored under your home folder : HOME\.eclipse\org.eclipse.equinox.security\ Finally, open Eclipse again.

4. Click on Browse to continue and select trunk and OK

5. Click on Next and answer YES to the question about normalizing the URL

6. On the next dialog, change from Simple Mode to Advanced Mode and

Page 11: Developing Android applications in Windows

leave the default values and go Next

7. Add some comments to your project sharing and select Finish.

Page 12: Developing Android applications in Windows

8. Here you can add extra comments to your code and how you were thinking when you committed your code. These comments might be of useful in the future when many persons are working on the same project.

9. Click on OK and your code will be submitted to the svn server.

Note: If HelloWorld already exists, change the project name before sharing

Step 9 Check out a (SVN) project

Now we should be able to check out a project and begin experimenting. For the demo, you can use the same username and password given above. The username and passwords for your particular groups which will be given first after you put together your project teams.

Note: The login and password might be remembered automatically and thus be set to “demo” or another group login on a shared computer, remember to use the procedure described in the previous step to force subversive to forget the credentials.

1. In Eclipse, go to File -> New -> Other Select Project from SVN and Next.

Page 13: Developing Android applications in Windows

2. The URL for the project is http://certec-svn.design.lth.se/svn/demo Enter your username and password

3. Click on Browse and select the Hello World demo in the trunk resource

directory that you committed before. Note: Since the project you are trying to check out is the same located in your local computer, delete or move the one in your local workspace before you continue. Be aware that ONLY the last committed changes will be available on the svn server.

4. Click on Next OK and Finish the import.

Page 14: Developing Android applications in Windows

5. The Check Out As dialog gives different ways on how to check out the

project. Just leave the default values and click Finish

Be aware that the projects there are for demo purposes and files might disappear

or be changed without warnings.

In order to commit your changes to the repository, right click on the project,

select Team -> Commit

Note: You will find additional tools that might be helpful for your project and

also ways to revert previous code.

Page 15: Developing Android applications in Windows

Developing Android applications in Windows with the Haptimap Toolkit

The HaptiMap toolkit adds more functionality to your projects and the library is added by

following the following steps

Step 1 Download the HaptiMap Toolkit The HaptiMap toolkit is available online and you can find more resources at http://haptimap.org

1. Log in or fulfil the registration procedure at http://haptimap.org/

2. Download the toolkit from http://haptimap.org/toolkit-download/download-page2.html

3. Extract the content to c:\HaptimapToolkit and read the README.txt

Page 16: Developing Android applications in Windows

There you will find information about the directory structure and where thing could be situated.

4. Since we are developing for the Android platform you can go directly to C:\HaptimapToolkit\toolkit\build\android and there you will find the INSTALL.txt Note: There are other platforms supported such as for iPhone and Windows. There is also a possibility to use other parts of the toolkit (core and mantle) that require cygwin, Apache Ant and Android NDK, but this is not covered in this tutorial. You can read more about this on https://haptimap.ee.qub.ac.uk/dev/wiki/UsingToolkitonAndroid

5. Iwe will be using the crust modules from the toolkit. You can access

them right away from the toolkit just by importing the HaptiMap toolkit as a library into your project. The HaptiMapToolkit must be imported as a project into Eclipse.

i. Start Eclipse

ii. Go to File -> Import and select Existing Projects into workspace Click on Next

iii. Choose Select root directory and Browse Select HaptimapToolkit\toolkit\crust\android\HaptiMapToolkit

Page 17: Developing Android applications in Windows

iv. The library import procedure is explained at point 5 of: https://haptimap.ee.qub.ac.uk/dev/wiki/UsingToolkitonAndroid

6. To check that the toolkit works properly, follow the HapticGuide tutorial linked on the course page.

Page 18: Developing Android applications in Windows

After these steps you should now be ready to start experimenting. If you feel you need to, use the tutorials to help you on the way, making gradual changes in the applications, trying to play sounds and starting the vibrator, for example. If you get stuck, these are the steps to follow:

a. Search for solutions online (there might be someone else who already has run into your problem).

b. Look in the wiki or ask in the forums referenced at http://haptimap.org/toolkit-help.html You can also find links to tutorials (menu to the left).

c. Ask Delphine for help: [email protected] , room 520 Jour times : wednesday 15.00 to 17.00 and friday 13.00 to 15.00

REMEMBER: Google is your friend ;o)

/ Kirre 091028 revised by Miguel 101022 revised by Delphine 121029