developing android applications in windows · developing android applications in windows below you...

16
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. Step 1 Install the JDK7 If you don’t have the Java Development Kit (JDK), you will need to install it. 1. Go to http://www.oracle.com/technetwork/java/javase/downloads and download the current version (7u45) 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! Method A: Fresh Installation of Android SDK (recommended) Step 2A Download and Install the Android SDK ADT Bundle 1. Go to http://developer.android.com/sdk and download the Android ADT Bundle, it includes Eclipse with built-in Android development tools and Android SDK components. 2. Accept the License Agreement and choose the same platform/architecture you chose when installing the Java JDK (32-bit or 64-bit). 3. If you are not sure which Java JDK version is installed, run a command prompt and run the following command: >> java –d64 –version If your Java JDK is 64-bit you will see the following message: Java(TM) SE Runtime Environment (build 1.7.0_45-b18) Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode) Otherwise, you will see:

Upload: others

Post on 23-Jan-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

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

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.

Step 1 Install the JDK7

If you don’t have the Java Development Kit (JDK), you will need to install it.

1. Go to http://www.oracle.com/technetwork/java/javase/downloads and download the current version (7u45)

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!

Method A: Fresh Installation of Android SDK (recommended)

Step 2A Download and Install the Android SDK ADT Bundle

1. Go to http://developer.android.com/sdk and download the Android ADT Bundle, it includes Eclipse with built-in Android development tools and Android SDK components.

2. Accept the License Agreement and choose the same platform/architecture you chose when installing the Java JDK (32-bit or 64-bit).

3. If you are not sure which Java JDK version is installed, run a command

prompt and run the following command: >> java –d64 –version

If your Java JDK is 64-bit you will see the following message: Java(TM) SE Runtime Environment (build 1.7.0_45-b18) Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

Otherwise, you will see:

Page 2: Developing Android applications in Windows · Developing Android applications in Windows Below you will find information about the components needed for developing Android applications

Error: This Java instance does not support a 64-bit JVM. To confirm you have the 32-bit version of JDK you can type the following from command prompt

>> java –d32 –version

4. Follow up by downloading and extracting the current SDK ADT Bundle to your local drive (c:\ adt-bundle-windows)

5. Go to c:\adt-bundle-windows\eclipse and start “eclipse.exe”.

6. That’s it, you can start developing Android applications . The ADT Bundle already comes with the necessary Platforms and Packages to start developing Android Apps.

7. If your intention is to use your private device, you can continue from Step

4B of this guide to add packages and platforms using the Android SDK Manager. Otherwise, continue from Step 5.

Method B: Installation over an existing IDE (Eclipse) If you already have an Eclipse installation that you prefer to use. You can download and install the Android SDK separately with the following steps. Otherwise is recommended that you make a fresh installation of the Android SDK using the ADT Bundle (Step 2a). Step 2B Download and install Android SDK

1. Download and install the Android SDK Tools installer from: http://developer.android.com/sdk/index.html#ExistingIDE

2. Make note of the name and location in which the SDK is saved on your system. You will need this location when setting up the ADT plugin.

3. When the installation completes the installer offerst to start the Android

SDK Manager. Do not start it! Instead move on to Installing the Eclipse Plugin

Step 3B Installing the Eclipse Plugin

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

Page 3: Developing Android applications in Windows · Developing Android applications in Windows Below you will find information about the components needed for developing Android applications

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.

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.

Page 4: Developing Android applications in Windows · Developing Android applications in Windows Below you will find information about the components needed for developing Android applications

Step 4B Adding Platforms and Packages

1. Open the Android SDK Manager from inside Eclipse. Make sure that the desired Android version is selected. You need at least ONE platform. We recommend that you choose version 4.0.3 (API 15) for the. 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

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

2. Install to continue

Note: The Android 4.3 is the latest release and is selected every time the SDK is launched. There are some dependencies that need to be solved and additional packages need to be downloaded. We have little experience with this release as of yet.

Page 5: Developing Android applications in Windows · Developing Android applications in Windows Below you will find information about the components needed for developing Android applications
Page 6: Developing Android applications in Windows · Developing Android applications in Windows Below you will find information about the components needed for developing Android applications

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.

2. Run the application and make sure it runs (at least) on the Android 4.0.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 Git client, which is not supported in our department. But you can use free GitHub if you prefer. The following steps are for using the SVN server at the 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.

Page 7: Developing Android applications in Windows · Developing Android applications in Windows Below you will find information about the components needed for developing Android applications

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.

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” (SVN Kit 1.7.8 is not compatible with SVN server at the department).

Page 8: Developing Android applications in Windows · Developing Android applications in Windows Below you will find information about the components needed for developing Android applications

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 · Developing Android applications in Windows Below you will find information about the components needed for developing Android applications

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

Page 10: Developing Android applications in Windows · Developing Android applications in Windows Below you will find information about the components needed for developing Android applications

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

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

Page 11: Developing Android applications in Windows · Developing Android applications in Windows Below you will find information about the components needed for developing Android applications

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 leave the default values and go Next

Page 12: Developing Android applications in Windows · Developing Android applications in Windows Below you will find information about the components needed for developing Android applications

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

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.

Page 13: Developing Android applications in Windows · Developing Android applications in Windows Below you will find information about the components needed for developing Android applications

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.

ote: 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 14: Developing Android applications in Windows · Developing Android applications in Windows Below you will find information about the components needed for developing Android applications

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 15: Developing Android applications in Windows · Developing Android applications in Windows Below you will find information about the components needed for developing Android applications

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.

Seeking Help 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 c. You can also find many tutorials online.

Page 16: Developing Android applications in Windows · Developing Android applications in Windows Below you will find information about the components needed for developing Android applications

d. Ask Hector for help: [email protected], room 522 available times : wednesdays 13.00-15.00 and thursdays 15.00-17.00

REMEMBER: Google is your friend ;o) / Kirre 091028 / revised by Miguel 101022 / revised by Delphine 121029 / revised by Hector 131021