[安卓] SL安卓終端核心庫編譯指導(dǎo)

1 依賴準(zhǔn)備

安卓版終端應(yīng)用基于linux,工程使用cmake管理,需要如下材料:

  • ubuntu 14+/debian8+ 虛擬機(jī)或系統(tǒng), 編譯環(huán)境
    sudo apt-get install build-essential cmake

  • Android NDK, 版本:android-ndk-r10e, (注意再高一點(diǎn)的版本會(huì)有編譯問題,需手動(dòng)調(diào)整)
    vi ~/.bashrc, 導(dǎo)出NDK路徑:
    export ANDROID_NDK=/home/yaohongtao/tools/android-ndk-r10e
    source ~/.bashrc, 刷新環(huán)境變量,使新設(shè)定的路徑生效

    ndk: http://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin
    all: http://www.cnblogs.com/yaotong/archive/2011/01/25/1943615.html

  • protobuf https://github.com/google/protobuf.git
    下載最新版本即可,默認(rèn)執(zhí)行源碼目錄下的autogen.sh: ./autogen.sh 生成配置文件,然后就可以
    ./configure
    make -j4 && make install
    ldconfig
    注意:autogen.sh中需要下載gmock依賴,如果電腦無法訪問谷歌,則注釋掉下載這部分即可:

... ... ... 
# Check that gmock is present.  Usually it is already there since the
# directory is set up as an SVN external.
# if test ! -e gmock; then
#   echo "Google Mock not present.  Fetching gmock-1.7.0 from the web..."
#   curl $curlopts -L -O https://github.com/google/googlemock/archive/release-1.7.0.zip
#   unzip -q release-1.7.0.zip
#   rm release-1.7.0.zip
#   mv googlemock-release-1.7.0 gmock

#   curl $curlopts -L -O https://github.com/google/googletest/archive/release-1.7.0.zip
#   unzip -q release-1.7.0.zip
#   rm release-1.7.0.zip
#   mv googletest-release-1.7.0 gmock/gtest
# fi

set -ex
... ... ...

2 編譯庫

2.1 安裝庫依賴:

源碼目錄/depends

cd depends
mkdir build
cd build && cmake ..
make -j4 && make install

2.2 編譯源碼

源碼目錄:執(zhí)行./mkandroid.sh

3 會(huì)生成libechat.so

然后提交到安卓上層,更新生成新的APK, 即可。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容