Project

General

Profile

How to compile and run the example code » History » Version 6

Distorted Admin, 06/02/2016 01:39 PM

1 1 Distorted Admin
h1. How to compile and run the example code
2
3 6 Distorted Admin
<pre>
4 1 Distorted Admin
This tutorial explains how to turn the 'library' and 'examples' code into an application you can run on your Android phone.
5
6
We are going to assume you are fairly familiar with Android development.
7
I personally use Android Studio; you can use Eclipse or even command line for your development but setting up the project will be different.
8 6 Distorted Admin
</pre>
9 1 Distorted Admin
10 3 Distorted Admin
# Download and install *Android Studio*: https://developer.android.com/studio/index.html
11
# Start it up and click on *Menu->File->New->New Project* to create a new, empty Project.
12 5 Distorted Admin
## In the *'New Project'* window set:
13 3 Distorted Admin
### Application Name: *Distorted Android*
14 4 Distorted Admin
### Company Domain: *distorted.org*
15
### Package Name: click 'edit' and change the default to *org.distorted.examples*
16 5 Distorted Admin
## In the *'Target Android Devices'* window, make sure *Phone and Tablet* is checked. Everything else can be unchecked.
17
## In the *'Add an Activity to Mobile'* select *Add No Activity*.
18 4 Distorted Admin
## Click *Finish* and an empty project will be created for you.
19 2 Distorted Admin
20 6 Distorted Admin
<pre>
21 5 Distorted Admin
Now we will need to download the sources and add both *'library'* and *'examples'* as new modules to the empty Project we've just created.
22 2 Distorted Admin
At the time I am writing this, Android Studio 2.1.1 does not seem to support adding new modules directly from a Git repository; that's why we will have to do this in two steps.
23 6 Distorted Admin
</pre>
24 2 Distorted Admin
25
# Download (git clone) the sources to a local directory:
26 5 Distorted Admin
## *Menu->VCS->Checkout from Version Control->Git*
27
## In the *'Clone Repository'* window, set *'Git Repository URL'* to *'http://distorted.org/git/distorted-library.git'*; you can leave the *'Parent Directory'* and *'Directory Name'* as they are.
28 2 Distorted Admin
## It will ask you if you want to open the new project file - don't do it.
29 5 Distorted Admin
## Repeat the above two steps again, this time setting the Git URL to *'http://distorted.org/git/distorted-examples.git'*
30 2 Distorted Admin
# Add the two newly created directories as modules to your Project:
31 5 Distorted Admin
## *Menu->File->New->Import Module...*
32
## Set source directory to wherever the cloned *'distorted-library'* is and click *'Finish'*.
33
## At this moment it may complain about missing Android SDK platforms and prompt you to *'Add root'* of the new VCS. Do both. Once you do it, you should see a new module called *'distorted-library'* in your Project's module list, right next to the automatically created *'app'* module.
34
## Repeat the above, this time giving it the location where *'distorted-examples'* got downloaded to. New module *'distorted-examples'* will appear.
35
## Now you can (and should!) remove the empty *'app'* module: 
36
### *Menu->File->Project Structure...*
37
### Click on the *'app'* module in the left
38
### Click on the *red minus sign* to remove it
39
### Go to your Project directory and remove the *'app'* directory from it.