forked from skullkey/FBReaderJ
-
Notifications
You must be signed in to change notification settings - Fork 3
/
HowToBuild
71 lines (53 loc) · 3.91 KB
/
HowToBuild
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
How to Build for Android
------------------------
Prerequisites:
1. Android SDK >= 1.6
2. Android NDK >= r4b
3. Python
4. We would recommend using Eclipse with the Android plugin
For those who use Eclipse for Android development (most of you), jump to Part B
------------------------------------------------------------------------------------------------
Part A.
------------------------------------------------------------------------------------------------
To build:
1. Create 'local.properties' file containing sdk.dir && ndk.dir definitions:
sdk.dir=<path to the Android SDK folder>
ndk.dir=<path to the Android NDK folder>
E.g., on my computer 'local.properties' consists of 2 lines:
sdk.dir=/Users/geometer/android-sdk-mac_86
ndk.dir=/Users/geometer/android-ndk-r4b
2. If you use Linux or MacOS, just run 'ant package' and go to step 3. For debugging
purposes, you might want to run 'ant dbg' for building the package in debug mode, signing
with your debug key (in this case, you can skip step 3).
If you are Windows user
2a. Run ndk-build (a program from Android NDK directory) in your project catalog;
This program only runs from Cygwin >= 1.7, please read NDK docs for details.
2b. Run ./createRawResources.py script.
2c. Run 'ant release'.
3. Sign your package manually.
------------------------------------------------------------------------------------------------------
Part B
------------------------------------------------------------------------------------------------------
1. Download the project code from git onto your local drive "git clone git://github.com/amahule/FBReaderJ.git".
2. Change the local.properties file to point to your Android SDK and NDK installations.
3. If you are running Linux or Mac OS, run "ant package" from inside the project directory containing build.xml. You may get some compile errors around the zip4j and bookshare classes, but don't worry at this point, since we will build with Eclipse.
If you are running Windows,
- Run ndk-build (a program from Android NDK directory) in your project catalog;
This program only runs from Cygwin >= 1.7, please read NDK docs for details.
- Run ./createRawResources.py script.
Make sure directories res/raw and res/drawable get created and are populated.
These newly created resource directories are mandatory for creating an Eclipse project.
4. Create a new Android project in Eclipse.
5. Choose create project from existing source. Point to the location of the downloaded code.
6. Put the Bookshare_API.jar and zip4j_1.1.7.jar on the build path (present in FBReaderJ directory). In Eclipse this is best done from FBReader->Properties->Java Build Path->Add JARs for both JAR files. This step should remove all the errors mentioned in the step 3.
7. To enable use of the Bookshare library, you need to obtain a developer key at http://developer.bookshare.org. One you have an application key, you need to enter it into org.geometerplus.android.fbreader.network.bookshare.BookshareDeveloperKey.java
8. Build from within Eclipse
9. The signed apk will be present in the /bin folder which can be installed on the Android device/emulator.
10. To test the Bookshare library, you need to add "bookshare.org" as a catalog from the Network Library option under the main menu. For more information on obtaining a test account, visit http://developer.bookshare.org
Side Notes:
One common reason the build steps mentioned in Part A may fail is because
the Android SDK and NDK locations in local.properties might not be correct.
Running the ndk-build enables compiles the native part of the code and creates shared object (.so) files.
Running the python script (createRawResources.py) creates the necessary directory structures of resources.
The Bookshare_API and zip4j_1.1.1.7 libraries should be included in the build path in the Eclipse project.
This shall remove the compilation errors and the apk file will be created after project is built in Eclipse.