# Development/BuildingForAndroid

Other languages:
Deutsch • ‎English • ‎español • ‎italiano • ‎日本語 • ‎한국어

## Installing the Android SDK

It might be simplest to install the Android Studio: https://developer.android.com/studio

• After some seconds, a gui displays and guides you (just select by default options if you never installed Android Studio) for configuring and downloading components (including SDK).
• There may be mksdcard error at the end of process.
• There'll be a directory ~/Android/Sdk, this is your ANDROID_HOME
• Go to File > Settings
• Type "SDK" into the search bar in the top-left corner.
• or follow Appearance & Behaviour > System Settings > Android SDK
• Here, install the latest SDK (or whichever you need/ prefer)

It is also possible to download the "Android SDK Platform-Tools" here https://developer.android.com/studio/releases/platform-tools and use the sdkmanager to install an SDK.

Go to Tools ▸ Android ▸ SDK Manager in Android Studio, Android SDK and go to SDK Tools tab, there click on NDK and install it.

## How to build it

The build instructions are very similar to the normal How To Build instructions.

We develop on Linux as the host environment. Windows is not supported. When you have the NDK and SDK, clone the git repo:

git clone git://gerrit.libreoffice.org/core libreoffice
cd libreoffice

# ARM Android
--with-distro=LibreOfficeAndroid
# or Android x86 ( preferable if using an AVD Emulator )
--with-distro=LibreOfficeAndroidX86
--with-android-sdk=~/Android/Sdk
--with-android-ndk=~/Android/Sdk/ndk-bundle


Configure (and install packages as needed) and build

./autogen.sh
make

## How to run it

cd android/source
make install

This will install the .apk to the default emulator or device.

## Hacking it

We appreciate any help with the development - every patch counts :-) If you don't know what to work on, have a look at the open Bugzilla tickets filed for the Android Viewer.

## Hints

If you want to speed-up your development cycle, use the Icecream distributed compiler. Specific instructions how to set it up for cross-compiling LibreOffice on Android are in the Using Icecream to speed up the LibreOffice Android build blog post.

## gtktiledviewer

gtktiledviewer is a test app that allows development of the LOK API implementations in LO core without any additional complexity (Android or Online both add complexity).

See the gnome-documents page about how to use the underlying GTK widget with that frontend.

At the moment gtktiledviewer has no testsuite, so here is a checklist to do manual testing if there is some larger rework on it.

Basic feature set:

1. Click inside a paragraph. Result: Caret appears at the position where the user clicked.
2. Click inside a paragraph, start typing. Result: text appears in the application.
3. Click inside a bullet list, type Enter. Result: new bullet is inserted, caret is on the new line.
4. Double-click inside a paragraph. Result: entire word is selected, the selection has handles to allow shrinking or growing the selection.
5. Drag the shown handles inside the paragraph. Result: the selection grows or shrinks according to the movements.
6. Text is selected, type a word. Result: The selected text is deleted, the word is typed in.
7. Double-click inside a cell in a table or a spreadsheet. Result: If empty, the entire cell is selected. If any text is there, the closest word is selected. If the handles are dragged outside of the cell boundary, selection turns into a able selection.
8. Click on an image. Result: selection rectangle of the image (including handles) appears.
9. Drag the image's selection handles. Result: The image is resized, keeping the aspect ratio.
10. Click on a text inside a shape. Result: Caret appears inside the shape text.
11. Click on the border of a shape. Result: Bounding box of the shape appears as the selection, including handles to manipulate the object.
12. Drag a handle of the shape's selection. Result: The shape resizes according to the drag. The resizing does not keep aspect ratio.
13. Select text (double-click on a word), trigger Bold action on the toolbar. Result: The selected text will be emboldened.

Features implemented after the TDF-funded project ended:

1. Search for something in the document. The search result is highlighted.
1. If the document is an Impress one, then if the search result is on a next slide, the viewer switches to that slide automatically and the part selector is updated.
2. If the search term is not found, the findbar is updated to say so.
3. If nothing is selected, then search starts from the top left corner of the visible area, not from the cursor position.
2. Desktop-style selection with the mouse (click somewhere, then drag the mouse to the end position).