Project

General

Profile

SDK » History » Version 15

John Smith, 03/26/2012 07:13 PM

1 1 John Smith
h1. SDK
2
3
h2. Rationale
4
5
Replicant uses its own SDK, which differs notably from the default Android SDK, as the latter contains non-free components.
6
7
[TODO: it might be helpful to try to list those, and summarize their functionality]
8
9
h2. Obtaining the Replicant SDK
10
11
The Replicant SDK can be obtained via FTP from:
12
13
http://ftp.osuosl.org/pub/replicant/sdk/0001/
14
15
h2. Installing the Replicant SDK
16
17
h3. Dependencies
18
19 5 John Smith
h4. Java Development Kit (JDK)
20 1 John Smith
21
You need a computer with a Java SE (Standard Edition) development kit version 1.6 or greater installed.
22
23 2 John Smith
Unless the Java installer for your platform does this automatically (installing an OpenJDK package from a repository under most Linux distributions does this) you may need to add your Java SDK's "bin" directory into your "PATH" environment variable, so that the command "javac" starts when issued from command line.
24 1 John Smith
25 6 John Smith
In some unlikely cases, creating a "JAVA_HOME" environment variable and pointing it to your JDK's true install location (not the "bin" directory but one level upward) may prove necessary.
26 2 John Smith
27 3 John Smith
h4. Eclipse
28 1 John Smith
29
You also need the Eclipse development environment -- preferably version 3.5. Version 3.6 is cautioned against in SDK documentation, mentioning that it currently has known isses.
30
31 3 John Smith
h3. Installing the "Android Development Tools" plugin for Eclipse
32 1 John Smith
33
If you have Eclipse installed and running properly, you need to install the Android Development Tools plugin.
34
35 8 John Smith
A solution for Eclipse 3.6 (not advised): some documentation recommends adding "https://dl-ssl.google.com/android/eclipse/" as a software update site in Eclipse, and pulling ADT from there. People have observed that this currently results in getting an ADT version which requires Eclipse 3.6, which has known issues and is not available in some widespread Linux distributions (e.g. Debian) at the moment.
36 1 John Smith
37
A somewhat manual solution:
38
39
* download ADT 0.9.8 into a stable location in your computer
40
41
http://dl.google.com/android/ADT-0.9.8.zip
42
Size: 8301417 B
43
MD5: 27e0de800512f13feae46fb554e6ee2f
44
45
* in Eclipse 3.5
46
47
- select "Window" > "Preferences" > "Install/Update" > "Available Software Sites"
48
- click the "Add" button
49
- name your software site something recognizable, e.g. "ADT 0.9.8"
50
- click "Archive" and select the "ADT-0.9.8.zip" file
51
52
* in Eclipse 3.5
53
54
- select "Help" > "Install New Software"
55
- select the "ADT 0.9.8" software site from the dropdown menu
56
- select the "Developer Tools" software package
57
- verify that the "Android DDMS" and "Android Development Tools" sub-packages were selected
58
- click the "Next" to install Android Developer Tools
59
60 2 John Smith
* restart Eclipse
61
62 1 John Smith
h3. Pointing "Android Development Tools" to the SDK directory
63
64 9 John Smith
When you have installed ADT and restarted Eclipse, select the "Window" menu. You should see a menu entry named "Android SDK and AVD Manager". Then select "Preferences" from the "Window" menu. A menu item named "Android" should be available on the left panel.
65 3 John Smith
66 11 John Smith
If not, something is wrong. You might have the wrong flavour of Eclipse installed (the Classic, Java or RCP flavours are recommended). For example, it has been observed that the default Eclipse version which installs under Debian 6.0 ("squeeze") does not install ADT correctly, while an installation of Eclipse Classic 3.5.2 ("Galileo") downloaded from http://archive.eclipse.org/eclipse/downloads/drops/R-3.5.2-201002111343/download.php?dropFile=eclipse-SDK-3.5.2-linux-gtk.tar.gz (MD5: bde55a2354dc224cf5f26e5320e72dac) works fine. 
67 2 John Smith
68 12 John Smith
Once the "Android" menu item is available in the "Window" > "Preferences" dialog, select it. In the main panel, click the "Browse" button for the "SDK Location" field, and point it to the directory where you unzipped your Replicant SDK. Then click "Apply" or "OK".
69
70
Next time you enter this dialog, a line saying "Android 2.2.1 / Android Open Source Project / Platform: 2.2.1 / API level: 8" should be present in the list of SDK targets.
71
72 13 John Smith
h3. Writing a "Hello World" app
73
74
h4. Creating an Android Virtual Device
75
76
To run your app in an emulator, you need to create an Android Virtual Device. In Eclipse, choose "Window" > "Android SDK and AVD Manager" > "Virtual Devices" > "New" and fill in the properties of the virtual device as follows:
77
78 14 John Smith
- Name: something descriptive like "AVD_for_Nexus_S"
79 13 John Smith
- Target: choose "Android 2.2.1 - API level 8" from the dropdown menu
80
- SD Card: specify the size of an emulated SD card, alternatively browse for an existing SD card image
81
- Skin: better choose "Default" and the screen resolution of your physical device, e.g. "WVGA800" for Nexus S
82
- leave other values at defaults and click "Create AVD"
83 1 John Smith
- if your disk is slow and you specified a large SD card image for creation, it may take a few seconds to complete
84 14 John Smith
85
h4. Create a project
86
87
In Eclipse, choose "File" > "New" > "Project". In the tree of possible project types, a branch named "Android" should exist. Open it, select the project type "Android Project" and click "Next".
88 15 John Smith
89
Enter a name for your project, e.g. "hello". For "Content", select "Create new project in workspace" and "use default location". The project will be created in your local Eclipse workspace directory, in a subdirectory corresponding to the project name.
90
91
Besides the project name, enter a friendly name for your application, e.g. "Hello World". Enter its package name, which can be either public (e.g. "com.example.hello") or private (e.g. "hello"). If you want the first piece of your application's user interface to be auto-created, leave the "Create Activity" checkbox checked and enter someting like "MainActivity" for the name of the "Activity" class to create.
92
93
Leave the minimum SDK version blank. Finally click "Finish" and your project should appear in Eclipse's left-hand projects tree.