forked from openframeworks/openFrameworks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
readme.android
135 lines (100 loc) · 5.34 KB
/
readme.android
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
Right now the android distribution of OF uses eclipse as the default IDE. android plugin for eclipse is not yet
very well prepared for working with native projects ( c/c++ ) so we are using a custom makefile solution. If you are used
to android development in eclipse, things are a little different check the following instructions to know how to
install the development environment and compile/install applications.
- Download & uncompress eclipse
- install the c/c++ development version
- in ubuntu better to download it from eclipse.org, the version in the repos is usually super outdated
- Download & uncompress OF
- Download & uncompress android sdk and ndk (this is tested with sdk 10 and ndk r5b)
- Install ant:
Linux:
sudo apt-get install ant-1.8
or for newer distributions:
sudo apt-get install ant
osx:
download and uncompress 1.8 or > from http://ant.apache.org/bindownload.cgi
- Only linux: install java
sudo apt-get install openjdk-6-jdk
- Edit OF/libs/openFrameworksCompiled/project/android/paths.make
- set paths of sdk & ndk to the uncompressed folders
- set ANT_HOME:
linux: /usr
osx: folder where you uncompressed ant including
- Open eclipse with workspace OF/apps/androidExamples
- Install adt plugin in eclipse
detailed instructions: http://developer.android.com/sdk/eclipse-adt.html
should do with:
- in eclipse, go to help -> install new software -> add:
name: Android ADT
location: https://dl-ssl.google.com/android/eclipse/
- check the Developer tools box, this will install:
-android DDMS
-android development tools
-android Hierarchy viewer
-android traceview
- Set eclipse java compiler compliance to 1.5:
Window > Preferences > Java > Compiler > Compiler compliance level: 1.5
- Set android eclipse settings:
Window > Preferences > Android > SDK Location
- Configure android targets:
Android button in toolbar > Available packages >
Install SDK platform 2.2 (makefiles and eclipse projects are configured for this one)
Install SDK platform tools
- Add virtual device (optional)
Android button in toolbar > Add device
- Import OF projects:
File > Import > General > Existing projects into workspace > Browse
Import in this order:
OF/libs
OF/libs/openFrameworks
OF/addons/ofxAndroid/ofAndroidLib
OF/apps/androidExamples
- Compile OF project, be sure target is set to Android (the hammer icon in toolbar)
- Compile all the examples
- Enable development in your device:
Adjustments > Applications > Development > USB Debug (the device needs to be disconnected from the computer)
- Connect the device now.
- Sometimes on linux adb needs to be run as root. With the device connected, in eclipse go to:
Window > show view > other... > Android > Devices
if the device doesn't appear in the list, from a terminal:
cd sdk_root (the folder where you uncompressed the sdk
sudo platform_tools/adb kill-server; sudo platform_tools/adb start-server
if the device doesn't appear try restarting eclipse
- Create an install external tool and use it to install projects on the device or emulator
Run > External Tools > External Tools Configuration
Select program and press New, name the new configuration: Android Install
Main:
Location: /usr/bin/make
Working Directory: ${project_loc}
Arguments: AndroidInstall PROJECT_PATH=${project_loc}
Refresh:
Mark Refresh resources upon completion
Select The selected resource
Build:
Mark Build before launch
Select The project containing the selected resource
Mark Include referenced projects
Press Apply and Close
- Now to install and run a project in the device:
- connect the device
- check that is working and restart adb server if necesary
- select the AndroidRelease target (in the hammer button in the toolbar)
- press the play button with a toolbox or Run > External Tools > Android Install
- To install a project in the emulator, do the same but with the device disconnected from the computer
- The AndroidDebug target does a different compilation process of the native code that allows to detect linker
errors that won't be detected when compiling in AndroidRelease mode. Is recomended to compile your application
in AndroidDebug mode at least once or if your application crashes before starting. To install applications
on the device or emulator is recommended to use the AndroidRelease mode since it's faster and the applications
will be much smaller. There's also no support for debug for native applications in eclipse but you could theoretically
use the ndk tools to debug an application compiled with AndroidDebug.
- Creating new applications:
You can copy any of the examples and start a new application from there.
You'll need to change the name of the application in different places:
- when you copy the application from an example set the name you want to use, let's say your application is called myApp
- in res/values/strings.xml change app_name value to the name of your application
- in AndroidManifest.xml change the name of the package from cc.openFrameworks.exampleName to cc.openframeworks.myApp
- in srcJava, select the package cc.openFrameworks.exampleName, press F2 to rename it and call it cc.openframeworks.myApp
It's important to keep the package prefix as cc.openframeworks somethings can stop working, this will be fixed in future versions
when eclipse support for native code is better
OF Team