diff options
Diffstat (limited to 'android')
-rw-r--r-- | android/README | 44 | ||||
-rw-r--r-- | android/android.make | 77 |
2 files changed, 97 insertions, 24 deletions
diff --git a/android/README b/android/README index c22ab604d1..04436b3c65 100644 --- a/android/README +++ b/android/README | |||
@@ -3,39 +3,41 @@ application for android. | |||
3 | 3 | ||
4 | * Prerequisites | 4 | * Prerequisites |
5 | 5 | ||
6 | Download and install the Android SDK[1] and NDK[2]. After you extracted the SDK, you need to run <sdk-dir>/tools/android in order to install the actual platform sdk from the available packages tab (SDK Platform Android 1.5 or above should work). In the virtual devices tab you can also setup a emulator. | 6 | Download and install the Android SDK[1] and NDK[2]. |
7 | After you extracted the SDK, you need to run <sdk-dir>/tools/android in order to | ||
8 | install the actual platform sdk from the available packages tab (SDK Platform | ||
9 | Android 1.5 or above should work). | ||
10 | In the virtual devices tab you can also setup a emulator. | ||
7 | 11 | ||
8 | 12 | ||
9 | Then, make sure you have the ANDROID_NDK_PATH (pointing to the NDK's root directory) environment variable set up, | 13 | Then, make sure you have the ANDROID_SDK_PATH and ANDROID_NDK_PATH (pointing to |
10 | otherwise configure will fail to find the compiler. | 14 | the each's root directory) environment variables set up, otherwise configure will fail to find the compiler and |
11 | 15 | compiling the java files will fail. | |
12 | 16 | ||
13 | * Build instructions | 17 | * Build instructions |
14 | 18 | ||
15 | Until there's a script which does all the work the procedure is documented here. | ||
16 | |||
17 | Use this as your build folder, using '../tools/configure' etc. | 19 | Use this as your build folder, using '../tools/configure' etc. |
18 | $ ../tools/configure | 20 | $ ../tools/configure # type 200, then chose A for android and your screen resolution |
19 | $ make | 21 | $ make |
20 | 22 | ||
21 | After the build finished, you need to copy librockbox.so to libs/armeabi/ (create that dir if it doesn't exit) | 23 | After the build finished, you can create a Rockbox.apk in bin/ |
22 | $ mkdir -p libs/armeabi | 24 | $ make apk |
23 | $ cp librockbox.so libs/armeabi | ||
24 | |||
25 | For the other files (codecs, themes), you execute 'make zip'. Then you copy the | ||
26 | zip to libs/armeabi, using the name libmisc.so. This is needed, since there's no | ||
27 | way to bundle stuff into apk's and have access to them from native code other | ||
28 | than pretending it was a library. | ||
29 | $ make zip | ||
30 | $ cp rockbox.zip libs/armeabi/libmisc.so | ||
31 | 25 | ||
32 | rockbox.zip..err, libmisc.so will be unpacked at runtime. | 26 | You can install that on the device |
27 | $ $ANDROID_SDK_PATH/tools/adb install -r bin/Rockbox.apk | ||
33 | 28 | ||
34 | To finish, you can follow this guide [3], or use eclipse. Simply install eclipse | ||
35 | and the android plugins, then import this folder as a new Android project and run it. | ||
36 | See [4] for a guide on how to set up eclipse for android development. | ||
37 | 29 | ||
30 | NOTE: make apk needs creates a debug signed .apk, not suitable for distribution. | ||
31 | It expects that this key already exists. | ||
32 | You should be able to generate it with "keytool" using the following options: | ||
33 | * Keystore name: "debug.keystore" | ||
34 | * Keystore password: "android" | ||
35 | * Key alias: "androiddebugkey" | ||
36 | * Key password: "android" | ||
37 | * CN: "CN=Android Debug,O=Android,C=US" | ||
38 | * validity: 365 days | ||
38 | 39 | ||
40 | Google docs mention the SDK tools can generate it as well, but I haven't found how yet. | ||
39 | 41 | ||
40 | [1]: http://developer.android.com/sdk/index.html | 42 | [1]: http://developer.android.com/sdk/index.html |
41 | [2]: http://developer.android.com/sdk/ndk/index.html | 43 | [2]: http://developer.android.com/sdk/ndk/index.html |
diff --git a/android/android.make b/android/android.make index e87ba39793..a6a7e675be 100644 --- a/android/android.make +++ b/android/android.make | |||
@@ -7,10 +7,81 @@ | |||
7 | # $Id$ | 7 | # $Id$ |
8 | # | 8 | # |
9 | 9 | ||
10 | # pretty empty here: android port has no additional .c files to compile, | 10 | .SECONDEXPANSION: # $$(JAVA_OBJ) is not populated until after this |
11 | # but a different rule for the final librockbox.so | ||
12 | |||
13 | .SECONDEXPANSION: # $$(OBJ) is not populated until after this | 11 | .SECONDEXPANSION: # $$(OBJ) is not populated until after this |
14 | 12 | ||
13 | |||
15 | $(BUILDDIR)/$(BINARY): $$(OBJ) $(VOICESPEEXLIB) $(FIRMLIB) $(SKINLIB) | 14 | $(BUILDDIR)/$(BINARY): $$(OBJ) $(VOICESPEEXLIB) $(FIRMLIB) $(SKINLIB) |
16 | $(call PRINTS,LD $(BINARY))$(CC) -o $@ $^ $(LDOPTS) $(GLOBAL_LDOPTS) | 15 | $(call PRINTS,LD $(BINARY))$(CC) -o $@ $^ $(LDOPTS) $(GLOBAL_LDOPTS) |
16 | |||
17 | PACKAGE=org.rockbox | ||
18 | PACKAGE_PATH=org/rockbox | ||
19 | ANDROID_DIR=$(ROOTDIR)/android | ||
20 | |||
21 | |||
22 | java2class = $(addsuffix .class,$(basename $(subst $(ANDROID_DIR),$(BUILDDIR),$(1)))) | ||
23 | |||
24 | ANDROID_PLATFORM_VERSION=8 | ||
25 | |||
26 | ANDROID_PLATFORM=$(ANDROID_SDK_PATH)/platforms/android-$(ANDROID_PLATFORM_VERSION) | ||
27 | AAPT=$(ANDROID_PLATFORM)/tools/aapt | ||
28 | DX=$(ANDROID_PLATFORM)/tools/dx | ||
29 | APKBUILDER=$(ANDROID_SDK_PATH)/tools/apkbuilder | ||
30 | ZIPALIGN=$(ANDROID_SDK_PATH)/tools/zipalign | ||
31 | |||
32 | |||
33 | MANIFEST := $(ANDROID_DIR)/AndroidManifest.xml | ||
34 | |||
35 | R_JAVA := $(BUILDDIR)/gen/$(PACKAGE_PATH)/R.java | ||
36 | R_OBJ := $(BUILDDIR)/bin/$(PACKAGE_PATH)/R.class | ||
37 | |||
38 | JAVA_SRC := $(wildcard $(ANDROID_DIR)/src/$(PACKAGE_PATH)/*.java) | ||
39 | JAVA_OBJ := $(call java2class,$(subst /src/,/bin/,$(JAVA_SRC))) | ||
40 | |||
41 | LIBS := $(BUILDDIR)/libs/armeabi/$(BINARY) $(BUILDDIR)/libs/armeabi/libmisc.so | ||
42 | TEMP_APK := $(BUILDDIR)/bin/_Rockbox.apk | ||
43 | APK := $(BUILDDIR)/bin/Rockbox.apk | ||
44 | |||
45 | $(R_JAVA): $(MANIFEST) | ||
46 | $(call PRINTS,AAPT $(subst $(BUILDDIR)/,,$<))$(AAPT) package -f -m -J $(BUILDDIR)/gen -M $(MANIFEST) -S $(ANDROID_DIR)/res -I $(ANDROID_PLATFORM)/android.jar -F $(BUILDDIR)/bin/resources.ap_ | ||
47 | |||
48 | $(BUILDDIR)/bin/$(PACKAGE_PATH)/R.class: $(R_JAVA) | ||
49 | $(call PRINTS,JAVAC $(subst $(BUILDDIR)/,,$<))javac -d $(BUILDDIR)/bin \ | ||
50 | -classpath $(ANDROID_PLATFORM)/android.jar:$(BUILDDIR)/bin -sourcepath \ | ||
51 | $(ANDROID_DIR)/gen:$(ANDROID_DIR)/src $< | ||
52 | |||
53 | $(BUILDDIR)/bin/$(PACKAGE_PATH)/%.class: $(ANDROID_DIR)/src/$(PACKAGE_PATH)/%.java | ||
54 | $(call PRINTS,JAVAC $(subst $(BUILDDIR)/,,$<))javac -d $(BUILDDIR)/bin \ | ||
55 | -classpath $(ANDROID_PLATFORM)/android.jar:$(BUILDDIR)/bin -sourcepath \ | ||
56 | $(ANDROID_DIR)/gen:$(ANDROID_DIR)/src $< | ||
57 | |||
58 | classes: $(R_OBJ) $(JAVA_OBJ) | ||
59 | |||
60 | $(BUILDDIR)/bin/classes.dex: classes | ||
61 | $(call PRINTS,DX $(subst $(BUILDDIR)/,,$@))$(DX) --dex --output=$@ $(BUILDDIR)/bin | ||
62 | |||
63 | dex: $(BUILDDIR)/bin/classes.dex | ||
64 | |||
65 | $(BUILDDIR)/libs/armeabi/$(BINARY): $(BUILDDIR)/$(BINARY) | ||
66 | $(call PRINTS,CP $(BINARY))cp $^ $@ | ||
67 | |||
68 | $(BUILDDIR)/_rockbox.zip: zip | ||
69 | $(SILENT)mv $(BUILDDIR)/rockbox.zip $@ | ||
70 | |||
71 | $(BUILDDIR)/libs/armeabi/libmisc.so: $(BUILDDIR)/_rockbox.zip | ||
72 | $(call PRINTS,CP rockbox.zip)cp $^ $@ | ||
73 | |||
74 | libs: $(LIBS) | ||
75 | |||
76 | $(TEMP_APK): libs dex | ||
77 | $(call PRINTS,APK $(subst $(BUILDDIR)/,,$@))$(APKBUILDER) $@ \ | ||
78 | -u -z $(BUILDDIR)/bin/resources.ap_ -f $(BUILDDIR)/bin/classes.dex -nf $(BUILDDIR)/libs | ||
79 | |||
80 | $(APK): $(TEMP_APK) | ||
81 | $(SILENT)rm -f $@ | ||
82 | $(call PRINTS,SIGN $(subst $(BUILDDIR)/,,$@))jarsigner \ | ||
83 | -keystore "$(HOME)/.android/debug.keystore" -storepass "android" \ | ||
84 | -keypass "android" -signedjar bin/__Rockbox.apk $^ "androiddebugkey" | ||
85 | $(SILENT)$(ZIPALIGN) -v 4 bin/__Rockbox.apk $@ > /dev/null | ||
86 | |||
87 | apk: $(APK) | ||