summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-09-02 03:40:02 +0000
committerThomas Martitz <kugel@rockbox.org>2010-09-02 03:40:02 +0000
commit4e982d30a15f04ac841b9e9669fa2dab5eef900b (patch)
tree9eac804d7f9db9c622ddf285f139147be33178bf
parentbd7af68ccde0065014f4faacb3f839825b79aa3c (diff)
downloadrockbox-4e982d30a15f04ac841b9e9669fa2dab5eef900b.tar.gz
rockbox-4e982d30a15f04ac841b9e9669fa2dab5eef900b.zip
Extend android.make so that it can generate a debug signed apk.
'make && make apk && adb install -r bin/Rockbox.apk' should work now. You should now be able to develop without eclipse. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27980 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--android/README44
-rw-r--r--android/android.make77
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
6Download 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. 6Download and install the Android SDK[1] and NDK[2].
7After you extracted the SDK, you need to run <sdk-dir>/tools/android in order to
8install the actual platform sdk from the available packages tab (SDK Platform
9Android 1.5 or above should work).
10In the virtual devices tab you can also setup a emulator.
7 11
8 12
9Then, make sure you have the ANDROID_NDK_PATH (pointing to the NDK's root directory) environment variable set up, 13Then, make sure you have the ANDROID_SDK_PATH and ANDROID_NDK_PATH (pointing to
10otherwise configure will fail to find the compiler. 14the each's root directory) environment variables set up, otherwise configure will fail to find the compiler and
11 15compiling the java files will fail.
12 16
13* Build instructions 17* Build instructions
14 18
15Until there's a script which does all the work the procedure is documented here.
16
17Use this as your build folder, using '../tools/configure' etc. 19Use 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
21After the build finished, you need to copy librockbox.so to libs/armeabi/ (create that dir if it doesn't exit) 23After 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
25For the other files (codecs, themes), you execute 'make zip'. Then you copy the
26zip to libs/armeabi, using the name libmisc.so. This is needed, since there's no
27way to bundle stuff into apk's and have access to them from native code other
28than pretending it was a library.
29 $ make zip
30 $ cp rockbox.zip libs/armeabi/libmisc.so
31 25
32rockbox.zip..err, libmisc.so will be unpacked at runtime. 26You can install that on the device
27 $ $ANDROID_SDK_PATH/tools/adb install -r bin/Rockbox.apk
33 28
34To finish, you can follow this guide [3], or use eclipse. Simply install eclipse
35and the android plugins, then import this folder as a new Android project and run it.
36See [4] for a guide on how to set up eclipse for android development.
37 29
30NOTE: make apk needs creates a debug signed .apk, not suitable for distribution.
31It expects that this key already exists.
32You 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
40Google 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
17PACKAGE=org.rockbox
18PACKAGE_PATH=org/rockbox
19ANDROID_DIR=$(ROOTDIR)/android
20
21
22java2class = $(addsuffix .class,$(basename $(subst $(ANDROID_DIR),$(BUILDDIR),$(1))))
23
24ANDROID_PLATFORM_VERSION=8
25
26ANDROID_PLATFORM=$(ANDROID_SDK_PATH)/platforms/android-$(ANDROID_PLATFORM_VERSION)
27AAPT=$(ANDROID_PLATFORM)/tools/aapt
28DX=$(ANDROID_PLATFORM)/tools/dx
29APKBUILDER=$(ANDROID_SDK_PATH)/tools/apkbuilder
30ZIPALIGN=$(ANDROID_SDK_PATH)/tools/zipalign
31
32
33MANIFEST := $(ANDROID_DIR)/AndroidManifest.xml
34
35R_JAVA := $(BUILDDIR)/gen/$(PACKAGE_PATH)/R.java
36R_OBJ := $(BUILDDIR)/bin/$(PACKAGE_PATH)/R.class
37
38JAVA_SRC := $(wildcard $(ANDROID_DIR)/src/$(PACKAGE_PATH)/*.java)
39JAVA_OBJ := $(call java2class,$(subst /src/,/bin/,$(JAVA_SRC)))
40
41LIBS := $(BUILDDIR)/libs/armeabi/$(BINARY) $(BUILDDIR)/libs/armeabi/libmisc.so
42TEMP_APK := $(BUILDDIR)/bin/_Rockbox.apk
43APK := $(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
58classes: $(R_OBJ) $(JAVA_OBJ)
59
60$(BUILDDIR)/bin/classes.dex: classes
61 $(call PRINTS,DX $(subst $(BUILDDIR)/,,$@))$(DX) --dex --output=$@ $(BUILDDIR)/bin
62
63dex: $(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
74libs: $(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
87apk: $(APK)