Android Office项目编译(LibreOffice cp-6.4-19&collaboraonline 6.4.3-3)

LibreOffice编译参考文档

1.编译环境ubuntu系统
sudo apt-get install git build-essential zip ccache junit4 libkrb5-dev nasm graphviz python3 python3-dev
qtbase5-dev libkf5coreaddons-dev libkf5i18n-dev libkf5config-dev libkf5windowsystem-dev libkf5kio-dev autoconf
libcups2-dev libfontconfig1-dev gperf default-jdk doxygen libxslt1-dev xsltproc libxml2-utils libxrandr-dev bison
flex libgtk-3-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev ant ant-optional

2.下载项目(libreoffice父目录不能包含中文)

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

cd libreoffice

3.在libreoffice目录下创建autogen.input,内容为:

ARM Android

--with-distro=LibreOfficeAndroid

or Android x86 ( preferable if using an AVD Emulator )

--with-distro=LibreOfficeAndroidX86

以下是NDK环境配置

--with-android-sdk=~/Android/Sdk
--with-android-ndk=~/Android/Sdk/ndk-bundle

4.git分支切换到 cp-6.4-19(commit id 5c603abc13b78dd7fd072249c9692dfc207a33c2)
git checkout 5c603abc13b78dd7fd072249c9692dfc207a33c2

5.编译
./autogen.sh
make
编译collaboraonline参考链接

6.安装 POCO for Android

在LibreOffice同级目录下下载poco-android `git clone https://github.com/pocoproject/poco poco-android

cd poco-android

使用 1.10.1 分支

git checkout -b poco-1.10.1 origin/poco-1.10.1

configure

./configure --config=Android --no-samples --no-tests --omit=Crypto,NetSSL_OpenSSL,Zip,Data,Data/SQLite,Data/ODBC,Data/MySQL,MongoDB,PDF,CppParser,PageCompiler,JWT

make 编译

~/Android/Sdk/ndk-bundle对应的是自己的NDK目录

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++

安装到 /opt/poco-android。

~/Android/Sdk/ndk-bundle对应的是自己的NDK目录

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

7.下载项目

在LibreOffice同级目录下下载CollaboraOnline

git clone https://github.com/CollaboraOnline/online.git online
cd online

切换分支

git checkout eec532f9df94d65da5ce260ececf81295e3542ab 8.编译CollaboraOnline

/Local/libreoffice是自己目录路径`

./autogen.sh
./configure --enable-androidapp \
            --with-lo-builddir=/Local/libreoffice \
            --with-poco-includes=/opt/poco-android/include --with-poco-libs=/opt/poco-android/lib \
            --disable-setcap \
            --enable-silent-rules --enable-debug
make

`9.踩坑日记
bug1:在编译LibreOffice的过程中提示Ant does not work - Some Java projects will not build!
checking if /usr/share/ant/bin/ant works... configure: error: Ant does not work - Some Java projects will not build!
configure: error: Running the configure script for BUILD side failed, see CONF-FOR-BUILD/config.log
configure: error: setup/configure for BUILD side failed, see CONF-FOR-BUILD/config.log
Error running configure at ./autogen.sh line 322.
解决方案:在autogen.input文件中禁用java:--without-java

bug2:在编译CollaboraOnline提示
警告: [options] 源值6已过时, 将在未来所有发行版中删除
警告: [options] 要隐藏有关已过时选项的警告, 请使用 -Xlint:-options。
/home/ls/office/libreoffice/android/source/src/java/org/libreoffice/overlay/CalcHeadersController.java:238: 错误: 不兼容的类型: long无法转换为Float
headerInfo.rowDimens.add(rowResult.getJSONObject(i).getLong("size"));
^
/home/ls/office/libreoffice/android/source/src/java/org/libreoffice/overlay/CalcHeadersController.java:243: 错误: 不兼容的类型: long无法转换为Float
headerInfo.columnDimens.add(columnResult.getJSONObject(i).getLong("size"));
解决方案:
在CalcHeadersController文件中将
rowResult.getJSONObject(i).getLong("size")
columnResult.getJSONObject(i).getLong("size")
替换为:(添加头文件import java.math.BigDecimal;
headerInfo.rowDimens.add(BigDecimal.valueOf(rowResult.getJSONObject(i).getLong("size")).floatValue());
headerInfo.columnDimens.add(BigDecimal.valueOf(columnResult.getJSONObject(i).getLong("size")).floatValue());

bug3:运行App,编辑页面空白
将/libreoffice/android/jniLibs/armeabi-v7a文件下载so文件替换成功线上App的so即可

--without-java --without-java--without-java`

你可能感兴趣的:(Android Office项目编译(LibreOffice cp-6.4-19&collaboraonline 6.4.3-3))