libreoffice-online/android
Jan Holesovsky f59e7a3740 android: Use the stripped liblo-native-code.so for the .apk.
Change-Id: If0b5fd34d8a834a7297b4a92aaa782876345cfc4
2019-04-05 18:16:58 +02:00
..
app android: Use the stripped liblo-native-code.so for the .apk. 2019-04-05 18:16:58 +02:00
.gitignore android: Settings for the build.gradle. 2019-02-15 16:53:35 +01:00
build.gradle android: Port document browser from the old Java app to the new one. 2019-03-27 14:35:21 +01:00
gradle.properties android: We need more memory for the build. 2019-02-22 14:21:04 +01:00
gradlew
gradlew.bat
README Tip how to cross-compile with icecream. 2019-03-20 15:46:11 +01:00
settings.gradle

The development of this Android app has to be done on Linux, it's currently not possible to
build the native parts on Windows.

* Compile LibreOffice master for Android.

  Do this in the folder where you cloned the LibreOffice core (e.g master-android).

  Create an autogen.input file:

      --build=x86_64-unknown-linux-gnu
      --with-android-ndk=/home/$USER/Android/Sdk/ndk-bundle
      --with-android-sdk=/home/$USER/Android/Sdk
      --with-distro=LibreOfficeAndroid
      --enable-sal-log

  Run ./autogen.sh && make

* Build the POCO for Android

  # clone the poco repository in the same folder where LibreOffice core and online folders are placed.
  git clone https://github.com/pocoproject/poco poco-android
  cd poco-android

  # use the 1.9.1 branch
  git checkout -b poco-1.9.1 origin/poco-1.9.1

  # configure
  ./configure --config=Android --no-samples --no-tests --minimal

  # make it
  PATH="$PATH":~/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin make -j8 ANDROID_ABI=armeabi-v7a CC=armv7a-linux-androideabi21-clang CXX=armv7a-linux-androideabi21-clang++ SYSLIBS=-static-libstdc++

  # install it to /opt/poco-android
  PATH="$PATH":~/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin make -j8 ANDROID_ABI=armeabi-v7a CC=armv7a-linux-androideabi21-clang CXX=armv7a-linux-androideabi21-clang++ SYSLIBS=-static-libstdc++ install INSTALLDIR=/opt/poco-android

* Configure the online.git (eg. in online-android folder)

  Don't forget to change --with-lo-builddir in the following:

  ./autogen.sh && ./configure CC=~/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang CXX=~/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang++ --host=arm-linux-androideabi --enable-androidapp --with-lo-builddir=/local/libreoffice/master-android --with-poco-includes=/opt/poco-android/include --with-poco-libs=/opt/poco-android/lib --disable-setcap --enable-silent-rules --enable-debug

* Build the JavaScript, HTML and CSS files also in the online-android folder

  # just run 'make'
  make

* Build the actual app

  + Start Android Studio
  + Open this 'android' subdir as a project
  + Build from Android Studio (Build -> Make Project)

== Tip: How to speed up your core.git build ==

If you use icecream for parallel building, you can use it for
cross-compilation too.

  # first generate a tarball with the toolchain (once)
  icecc-create-env ~/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang ~/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang++

And add it and the paths to the compiler as the first things to the
autogen.input:

  CC=icecc [here copy what the output of ./autogen.sh without icecream said for C compiler]
  CXX=icecc [here copy what the output of ./autogen.sh without icecream said for C++ compiler]
  ICECC_VERSION=/path/to/the/tarball/generated/above/955ceb546ceb7a5715bf0223ddd788fe.tar.gz
  --with-parallelism=[amount of cpu threads in your icecream farm]
  --enable-icecream
  [...the original autogen.input...]

So the result will look something like this:

  CC=icecc /home/$USER/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8 -gcc-toolchain /home/$USER/Android/Sdk/ndk-bundle/to>
  CXX=icecc /home/$USER/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8 -gcc-toolchain /home/$USER/Android/Sdk/ndk-bundle>
  ICECC_VERSION=/local/libreoffice/android/955ceb546ceb7a5715bf0223ddd788fe.tar.gz
  --with-parallelism=25
  --enable-icecream
  --build=x86_64-unknown-linux-gnu
  --with-android-ndk=/home/$USER/Android/Sdk/ndk-bundle
  --with-android-sdk=/home/$USER/Android/Sdk
  --with-distro=LibreOfficeAndroid
  --enable-sal-log