Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4680 | right-hear | 1 | To build/debug android build. |
2 | |||
3 | 1) Download the android sdk, and install it. On windows I unpacked it as: |
||
4 | |||
5 | C:\Program Files\android-sdk-windows |
||
6 | |||
7 | on Macos as: |
||
8 | |||
9 | /Library/android-sdk-mac_x86 |
||
10 | |||
11 | On windows add: C:/Progra~1/android-sdk-windows/tools to your path. |
||
12 | On linux/macos add the equivalent. |
||
13 | |||
14 | 2) Download the android ndk, and install in. On windows I unpacked it as: |
||
15 | |||
16 | C:\Program Files\android-ndk-r5 |
||
17 | |||
18 | on Macos as: |
||
19 | |||
20 | /Library/android-ndk-r5 |
||
21 | |||
22 | On windows add: C:/Progra~1/android-ndk-r5 to your path. On linux/macos |
||
23 | add the equivalent. |
||
24 | |||
25 | 3) On windows, to use the ndk, you *must* be running under cygwin. This means |
||
26 | you need to install Cygwin 1.7 or greater now. |
||
27 | |||
28 | In the current release of the ndk (r5), when running under cygwin, there are |
||
29 | bugs to do with the automatic conversion of dependencies from DOS format |
||
30 | paths to cygwin format paths. The 2 fixes can be found in: |
||
31 | |||
32 | |||
33 | |||
34 | 4) Bring up a shell, and run 'android'. This will bring up a graphical |
||
35 | gui for the sdk. From here you can install the different SDK components |
||
36 | for the different flavours of android. Download them all - bandwidth and disk |
||
37 | space are cheap, right? |
||
38 | |||
39 | 5) Now go to the Virtual Devices entry on the right hand side. You need to |
||
40 | create yourself an emulator image to use. Click 'New...' on the right hand |
||
41 | side and a window will appear. Fill in the entries as follows: |
||
42 | |||
43 | Name: FroyoEm |
||
44 | Target: Android 2.2 - API Level 8 |
||
45 | SD card: Size: 1024MiB |
||
46 | Skin: Resolution: 480x756 (756 just fits my macbook screen, but 800 may |
||
47 | be 'more standard') |
||
48 | |||
49 | Click 'Create AVD' and wait for a minute or so while it is prepared. Now |
||
50 | you can exit the GUI. |
||
51 | |||
52 | 6) Now we are ready to build mupdf for Android. Check out a copy of MuPDF |
||
53 | (but you've done that already, cos you're reading this, right?). |
||
54 | |||
55 | 7) You will also need a copy of mupdf-thirdparty.zip (see the source code |
||
56 | link on http://mupdf.com/). Unpack the contents of this into a 'thirdparty' |
||
57 | directory created within the mupdf directory (i.e. at the same level as |
||
58 | fitz, pdf, android etc). |
||
59 | |||
60 | 8) Finally, you will need a copy of a 'generated' directory. This is not |
||
61 | currently available to download. The easiest way to obtain this is to do |
||
62 | a standard windows or linux build of mupdf, which generates the required |
||
63 | files as part of the build process. |
||
64 | |||
65 | 9) Change into the android directory, and edit local.properties into your |
||
66 | favourite editor. Change the sdk path there as appropriate. This should be |
||
67 | the only bit of localisation you need to do. |
||
68 | |||
69 | 10) Change into the android directory (note, the android directory, NOT |
||
70 | the android/jni directory!), and execute (in a Cygwin window on Windows!): |
||
71 | |||
72 | ndk-build |
||
73 | |||
74 | This should build the native code portion. Then execute: |
||
75 | |||
76 | ant debug |
||
77 | |||
78 | or on windows under cygwin: |
||
79 | |||
80 | ant.bat debug |
||
81 | |||
82 | This should build the java wrapper. |
||
83 | |||
84 | 11) Now start the emulator by executing: |
||
85 | |||
86 | emulator -avd FroyoEm |
||
87 | |||
88 | This will take a while to full start up (be patient). |
||
89 | |||
90 | 12) We now need to give the demo file something to chew on, so let's copy |
||
91 | a file into the SD card image of the emulator (this should only need to be |
||
92 | done once). With the emulator running type: |
||
93 | |||
94 | adb push ../../MyTests/pdf_reference17.pdf /mnt/sdcard/Download/test.pdf |
||
95 | |||
96 | (where obviously ../../MyTests/pdf_reference17.pdf is altered for your |
||
97 | machine). (adb lives in |
||
98 | |||
99 | 13) With the emulator running (see step 11), execute |
||
100 | |||
101 | ant install |
||
102 | |||
103 | ('ant.bat install' on Windows) and that will copy MuPDF into the emulator |
||
104 | where you can run it from the launchpad screen. |
||
105 | |||
106 | 14) To see debug messages from the emulator (including stdout/stderr from |
||
107 | our app), execute: |
||
108 | |||
109 | adb logcat |
||
110 | |||
111 | Good luck! |