forked from benetech/FBReaderJ
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHowToBuild
66 lines (48 loc) · 3.49 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
How to Build for Android
------------------------
Prerequisites:
1. Android SDK >= 4.03
2. Android NDK >= r4b
3. Apache Ant >= 1.7.0
4. (Windows-only) Cygwin >= 1.7
For those who use Eclipse for Android development (most of you), jump to Part B
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.
Read and try config cygwin using 'cygwin_installation_and_configuration.pdf'
2b. 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/benetech/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 .jar files in the /libs directory in 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 or 'ant clean debug' to build an installable .apk file
9. The signed apk will be present in the /bin folder which can be installed on the Android device/emulator.
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.
The Bookshare-API, zip4j_1.1.1.7, and other libraries in /lib 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.