Skip to content

BuildingFromSource

Klaus Weidner edited this page Nov 20, 2018 · 5 revisions

Instructions originally contributed by Christian Holm Christensen, thank you!

You can get the sources for the app from Github as usual.

Developing using Android Studio

At this point the project is still using ant for building, not gradle, but Android Studio will work with that also. Ignore the suggestion to migrate to gradle if it prompts you to do that.

Using dictionaries requires using the Android NDK for native code compilation in addition to the SDK. The application will work without that, just without spelling dictionaries. This may be sufficient if you're testing new layout or other patch, but if you want a fully working version you'll need to install the NDK too:

Developing using Eclipse

Warning: The Eclipse IDE is no longer officially supported by Google. If you're getting started, you'll probably want to use Android Studio instead (see above). Keeping the instructions around for reference.

First off, you need the Android SDK and NDK available at

http://developer.android.com/sdk http://developer.android.com/sdk/ndk

I'll assume you've unpacked these to ~/android/sdk and ~/android/ndk respectively. You don't need to do that, but adjust paths accordingly.

Then, you should get the Android Development Tool (ADT) plug-in at

http://developer.android.com/sdk/eclipse-adt.html

To be effective, you should use the Git plug-in

Note, that this will check out a directory structure that doesn't really correspond to the directory structure expected by the ADT plug-in. You should therefore use the File->New->Android Project wizard to set up another project. Make sure you select Create Project from existing sources and select the sub-directory java of the sources you check out before. The project settings should be filled out automatically - except the project name - it could be something like 'my-hackerskeyboard'

The app contains Native code (C++ code) which must be compiled into a shared library. This library is then loaded at run-time by the application, and through the Java Native Interface (JNI) protocol (member) functions in that library is called. However, the standard set-up of the ADT does not compile JNI code on its own. You should therefore set up a custom builder.

Right click the project and select Properties, or select Project->Properties from the menu. Select Builders and click New. In the dialog, select Program. In the next window, give it a name - say Android NDK builder, point the Location to ~/android/ndk/ndk-build and set the working directory to the variable ${project_loc}. In the Refresh tab, select Refresh project. In the Build Options tag, select After a "Clean", Manual builds, During auto builds, and During "Clean".

Now, clean the project (perhaps twice) and run the app.

Other stuff

Make Git ignore some (generated) files

Perhaps you want to add the file .gitignore in your check-out directory with content like

        java/bin
        java/obj
        java/gen
        java/libs
        java/.classpath
        java/.project
        java/default.properties
        .project

so that you do not get 'funny' output from 'git status' or the like

Happy coding.

Clone this wiki locally