Android matter編譯chiptool app

環(huán)境需要

  • java
  • Android sdk
    • api 26
  • android ndk
  • ninja(安裝詳細(xì)見(jiàn)后面問(wèn)題)
  • kotlin(安裝詳細(xì)見(jiàn)后面問(wèn)題)
  • 20G左右的磁盤空間

克隆matter代碼庫(kù)

  • git clone https://github.com/project-chip/connectedhomeip.git
  • 完整教程

編譯依賴庫(kù)

  • cd code/android/connectedhomeip
  • 執(zhí)行source scripts/bootstrap.sh
    • 已有Android開(kāi)發(fā)環(huán)境前提下
    • 按照說(shuō)明文檔調(diào)用腳本循集,編譯本地庫(kù)
    • 腳本會(huì)拉取所需第三方庫(kù),Setting up CIPD package manager<font color='red'>這一步需要1小時(shí)候左右</font>
    • 完整輸出:
wuyifan@wuyifandeMac-mini connectedhomeip % source scripts/bootstrap.sh
為 'examples/common/QRCode/repo' 同步子模組 url
為 'examples/common/m5stack-tft/repo' 同步子模組 url
為 'third_party/boringssl/repo/src' 同步子模組 url
為 'third_party/bouffalolab/repo' 同步子模組 url
為 'third_party/cirque/repo' 同步子模組 url
為 'third_party/editline/repo' 同步子模組 url
為 'third_party/freertos/repo' 同步子模組 url
為 'third_party/imgui/repo' 同步子模組 url
為 'third_party/infineon/cyw30739_sdk/repos/30739A0' 同步子模組 url
為 'third_party/infineon/cyw30739_sdk/repos/CYW930739M2EVB-01' 同步子模組 url
為 'third_party/infineon/cyw30739_sdk/repos/btsdk-include' 同步子模組 url
為 'third_party/infineon/cyw30739_sdk/repos/btsdk-tools' 同步子模組 url
為 'third_party/infineon/psoc6/psoc6_sdk/libs/TARGET_CY8CKIT-062S2-43012' 同步子模組 url
為 'third_party/infineon/psoc6/psoc6_sdk/libs/abstraction-rtos' 同步子模組 url
為 'third_party/infineon/psoc6/psoc6_sdk/libs/anycloud-ota' 同步子模組 url
為 'third_party/infineon/psoc6/psoc6_sdk/libs/bluetooth-freertos' 同步子模組 url
為 'third_party/infineon/psoc6/psoc6_sdk/libs/btstack' 同步子模組 url
為 'third_party/infineon/psoc6/psoc6_sdk/libs/clib-support' 同步子模組 url
為 'third_party/infineon/psoc6/psoc6_sdk/libs/connectivity-utilities' 同步子模組 url
為 'third_party/infineon/psoc6/psoc6_sdk/libs/core-lib' 同步子模組 url
為 'third_party/infineon/psoc6/psoc6_sdk/libs/core-make' 同步子模組 url
為 'third_party/infineon/psoc6/psoc6_sdk/libs/freertos' 同步子模組 url
為 'third_party/infineon/psoc6/psoc6_sdk/libs/kv-store' 同步子模組 url
為 'third_party/infineon/psoc6/psoc6_sdk/libs/lwip' 同步子模組 url
為 'third_party/infineon/psoc6/psoc6_sdk/libs/mbedtls' 同步子模組 url
為 'third_party/infineon/psoc6/psoc6_sdk/libs/mtb-hal-cat1' 同步子模組 url
為 'third_party/infineon/psoc6/psoc6_sdk/libs/mtb-pdl-cat1' 同步子模組 url
為 'third_party/infineon/psoc6/psoc6_sdk/libs/psoc6cm0p' 同步子模組 url
為 'third_party/infineon/psoc6/psoc6_sdk/libs/recipe-make-cat1a' 同步子模組 url
為 'third_party/infineon/psoc6/psoc6_sdk/libs/retarget-io' 同步子模組 url
為 'third_party/infineon/psoc6/psoc6_sdk/libs/secure-sockets' 同步子模組 url
為 'third_party/infineon/psoc6/psoc6_sdk/libs/serial-flash' 同步子模組 url
為 'third_party/infineon/psoc6/psoc6_sdk/libs/whd-bsp-integration' 同步子模組 url
為 'third_party/infineon/psoc6/psoc6_sdk/libs/wifi-connection-manager' 同步子模組 url
為 'third_party/infineon/psoc6/psoc6_sdk/libs/wifi-host-driver' 同步子模組 url
為 'third_party/infineon/psoc6/psoc6_sdk/libs/wifi-mw-core' 同步子模組 url
為 'third_party/jsoncpp/repo' 同步子模組 url
為 'third_party/libwebsockets/repo' 同步子模組 url
為 'third_party/mbed-mcu-boot/repo' 同步子模組 url
為 'third_party/mbed-os-cypress-capsense-button/repo' 同步子模組 url
為 'third_party/mbed-os-posix-socket/repo' 同步子模組 url
為 'third_party/mbed-os/repo' 同步子模組 url
為 'third_party/mbedtls/repo' 同步子模組 url
為 'third_party/mt793x_sdk/filogic' 同步子模組 url
為 'third_party/mt793x_sdk/lwip' 同步子模組 url
為 'third_party/mt793x_sdk/mDNSResponder' 同步子模組 url
為 'third_party/nanopb/repo' 同步子模組 url
為 'third_party/nlassert/repo' 同步子模組 url
為 'third_party/nlfaultinjection/repo' 同步子模組 url
為 'third_party/nlio/repo' 同步子模組 url
為 'third_party/nlunit-test/repo' 同步子模組 url
為 'third_party/nxp/mw320_sdk/repo' 同步子模組 url
為 'third_party/open-iot-sdk/sdk' 同步子模組 url
為 'third_party/open-iot-sdk/storage' 同步子模組 url
為 'third_party/openthread/ot-efr32' 同步子模組 url
為 'third_party/openthread/ot-ifx' 同步子模組 url
為 'third_party/openthread/ot-nxp' 同步子模組 url
為 'third_party/openthread/ot-qorvo' 同步子模組 url
為 'third_party/openthread/repo' 同步子模組 url
為 'third_party/ot-br-posix/repo' 同步子模組 url
為 'third_party/pigweed/repo' 同步子模組 url
為 'third_party/pybind11/repo' 同步子模組 url
為 'third_party/qpg_sdk/repo' 同步子模組 url
為 'third_party/silabs/gecko_sdk' 同步子模組 url
為 'third_party/silabs/matter_support' 同步子模組 url
為 'third_party/silabs/wiseconnect-wifi-bt-sdk' 同步子模組 url
為 'third_party/simw-top-mini/repo' 同步子模組 url
為 'third_party/ti_simplelink_sdk/repo_cc13xx_cc26xx' 同步子模組 url
為 'third_party/ti_simplelink_sdk/repo_cc32xx' 同步子模組 url

  WELCOME TO...

         █
         █
     ▄   █   ▄                                █     █
     ??█████??      ▄???▄ ▄???▄    ▄????▄█  ??█?????█??   ▄????▄    ▄??
   ?█▄       ▄█?   █     █     █  █      █    █     █    █▄▄▄▄▄▄█  █   
     ?█▄   ▄█?     █     █     █  █      █    █     █    █         █   
  ▄██??█   █??██▄  █     █     █   ?▄▄▄▄?█    ?▄▄   ?▄▄   ?▄▄▄▄?   █   
 ??    █   █    ??

  BOOTSTRAP! Bootstrap may take a few minutes; please be patient.

Downloading and installing packages into local source directory:

  Setting up CIPD package manager...done (63m57.2s)
  Setting up Python environment.....done (10m9.0s)
  Setting up pw packages............skipped (0.1s)
  Setting up Host tools.............done (0.1s)

Activating environment (setting environment variables):

  Setting environment variables for CIPD package manager...done
  Setting environment variables for Python environment.....done
  Setting environment variables for pw packages............skipped
  Setting environment variables for Host tools.............done

Checking the environment:

20230406 15:51:52 WRN Current uname (21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:29 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T8101 arm64) does not match Bootstrap uname (21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:29 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T8101 arm64), you may need to rerun bootstrap on this system
20230406 15:51:52 INF Environment passes all checks!

Environment looks good, you are ready to go!

To reactivate this environment in the future, run this in your 
terminal:

  source ./activate.sh

To deactivate this environment, run this:

  deactivate


  • 執(zhí)行./scripts/build/build_examples.py --target android-arm64-chip-tool build
  • 安裝adb install out/android-arm64-chip-tool/outputs/apk/debug/app-debug.apk
  • android studio運(yùn)行構(gòu)建
    • 打開(kāi)/out/android-arm64-chip-tool/lib/build/chip/java/tests/
    • 復(fù)制child_jar.jar到chiptool項(xiàng)目libs目錄泳姐,重新構(gòu)建項(xiàng)目
    • 運(yùn)行

問(wèn)題

環(huán)境變量

需要Android sdk拿穴、ndk碰酝,以及python環(huán)境

  • ANDROID_HOME
  • ANDROID_NDK_HOME
  • JAVA_HOME
    macOS:
export ANDROID_HOME=~/Library/Android/sdk
export ANDROID_NDK_HOME=~/Library/Android/sdk/ndk/21.4.7075529
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/Contents/Home/

遇到無(wú)法clone提示丐黄。

fatal: 無(wú)法訪問(wèn) 'https://github.com/Qorvo/QMatter/':HTTP/2 stream 1 was not closed cleanly before end of the underlying stream
fatal: 無(wú)法克隆 'https://github.com/Qorvo/QMatter' 到子模組路徑 '/Users/wuyifan/code/android/connectedhomeip/third_party/qpg_sdk/repo'
克隆 'third_party/qpg_sdk/repo' 失敗绊序。按計(jì)劃重試

fatal: 無(wú)法克隆 'xxx' 到子模組路徑 'xxx'纷宇,可以手動(dòng)克隆到對(duì)應(yīng)目錄

git clone https://github.com/Qorvo/QMatter /Users/wuyifan/code/android/connectedhomeip/third_party/qpg_sdk/repo

Setting up CIPD package manager...出現(xiàn)python報(bào)錯(cuò)

  • TimeoutError: [Errno 60] Operation timed out
  • socket.gaierror: [Errno 8] nodename nor servname provided, or not known

更換網(wǎng)絡(luò)或VPN

提示which was not found.

ERROR at //third_party/nlio/BUILD.gn:19:1: Source file not found.
source_set("nlio") {
^-------------------
The target:
  //third_party/nlio:nlio
has a source file:
  //third_party/nlio/repo/include/nlio.h
which was not found.
___________________
ERROR at //third_party/nlio/BUILD.gn:19:1: Source file not found.
source_set("nlio") {
^-------------------
The target:
  //third_party/nlio:nlio
has a source file:
  //third_party/nlio/repo/include/nlio.hpp
which was not found.
___________________
ERROR at //third_party/nlunit-test/BUILD.gn:30:1: Source file not found.
static_library("nlunit-test") {
^------------------------------
The target:
  //third_party/nlunit-test:nlunit-test
has a source file:
  //third_party/nlunit-test/repo/src/nlunit-test.h
which was not found.
___________________
ERROR at //third_party/nlunit-test/BUILD.gn:30:1: Source file not found.
static_library("nlunit-test") {
^------------------------------
The target:
  //third_party/nlunit-test:nlunit-test
has a source file:
  //third_party/nlunit-test/repo/src/nlunit-test.c
which was not found.

還有庫(kù)沒(méi)有下載夸盟,github搜索后git clone./third_party/指定目錄

提示WARNING ninja: error: loading 'build.ninja': No such file or directory

安裝ninja教程傳送門像捶,然后刪除out目錄下文件夾上陕,緩存會(huì)影響下次編譯

提示kotlinc: command not found

  • 安裝kotlin
brew install kotlin

Github項(xiàng)目地址

已編譯成功jar、so庫(kù)拓春,so文件太大已經(jīng)壓縮分包释簿,clone后解壓so文件即可運(yùn)行,傳送門

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末硼莽,一起剝皮案震驚了整個(gè)濱河市庶溶,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌懂鸵,老刑警劉巖偏螺,帶你破解...
    沈念sama閱讀 219,039評(píng)論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場(chǎng)離奇詭異匆光,居然都是意外死亡套像,警方通過(guò)查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,426評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門殴穴,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)凉夯,“玉大人,你說(shuō)我怎么就攤上這事采幌【⒐唬” “怎么了?”我有些...
    開(kāi)封第一講書(shū)人閱讀 165,417評(píng)論 0 356
  • 文/不壞的土叔 我叫張陵休傍,是天一觀的道長(zhǎng)征绎。 經(jīng)常有香客問(wèn)我,道長(zhǎng)磨取,這世上最難降的妖魔是什么人柿? 我笑而不...
    開(kāi)封第一講書(shū)人閱讀 58,868評(píng)論 1 295
  • 正文 為了忘掉前任,我火速辦了婚禮忙厌,結(jié)果婚禮上凫岖,老公的妹妹穿的比我還像新娘。我一直安慰自己逢净,他們只是感情好哥放,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,892評(píng)論 6 392
  • 文/花漫 我一把揭開(kāi)白布歼指。 她就那樣靜靜地躺著,像睡著了一般甥雕。 火紅的嫁衣襯著肌膚如雪踩身。 梳的紋絲不亂的頭發(fā)上,一...
    開(kāi)封第一講書(shū)人閱讀 51,692評(píng)論 1 305
  • 那天社露,我揣著相機(jī)與錄音挟阻,去河邊找鬼。 笑死峭弟,一個(gè)胖子當(dāng)著我的面吹牛附鸽,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播孟害,決...
    沈念sama閱讀 40,416評(píng)論 3 419
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼拒炎,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼挪拟!你這毒婦竟也來(lái)了挨务?” 一聲冷哼從身側(cè)響起,我...
    開(kāi)封第一講書(shū)人閱讀 39,326評(píng)論 0 276
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤玉组,失蹤者是張志新(化名)和其女友劉穎谎柄,沒(méi)想到半個(gè)月后,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體惯雳,經(jīng)...
    沈念sama閱讀 45,782評(píng)論 1 316
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡朝巫,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,957評(píng)論 3 337
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了石景。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片劈猿。...
    茶點(diǎn)故事閱讀 40,102評(píng)論 1 350
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖潮孽,靈堂內(nèi)的尸體忽然破棺而出揪荣,到底是詐尸還是另有隱情,我是刑警寧澤往史,帶...
    沈念sama閱讀 35,790評(píng)論 5 346
  • 正文 年R本政府宣布仗颈,位于F島的核電站,受9級(jí)特大地震影響椎例,放射性物質(zhì)發(fā)生泄漏挨决。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,442評(píng)論 3 331
  • 文/蒙蒙 一订歪、第九天 我趴在偏房一處隱蔽的房頂上張望脖祈。 院中可真熱鬧,春花似錦刷晋、人聲如沸盖高。這莊子的主人今日做“春日...
    開(kāi)封第一講書(shū)人閱讀 31,996評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)或舞。三九已至荆姆,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間映凳,已是汗流浹背胆筒。 一陣腳步聲響...
    開(kāi)封第一講書(shū)人閱讀 33,113評(píng)論 1 272
  • 我被黑心中介騙來(lái)泰國(guó)打工, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留诈豌,地道東北人仆救。 一個(gè)月前我還...
    沈念sama閱讀 48,332評(píng)論 3 373
  • 正文 我出身青樓,卻偏偏與公主長(zhǎng)得像矫渔,于是被迫代替她去往敵國(guó)和親彤蔽。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,044評(píng)論 2 355