美文网首页
Android matter编译chiptool app

Android matter编译chiptool app

作者: yifan_ | 来源:发表于2023-04-06 10:10 被阅读0次

    环境需要

    • java
    • Android sdk
      • api 26
    • android ndk
    • ninja(安装详细见后面问题)
    • kotlin(安装详细见后面问题)
    • 20G左右的磁盘空间

    克隆matter代码库

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

    编译依赖库

    • cd code/android/connectedhomeip
    • 执行source scripts/bootstrap.sh
      • 已有Android开发环境前提下
      • 按照说明文档调用脚本,编译本地库
      • 脚本会拉取所需第三方库,Setting up CIPD package manager<font color='red'>这一步需要1小时候左右</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
    
    
    
    • 执行./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运行构建
      • 打开/out/android-arm64-chip-tool/lib/build/chip/java/tests/
      • 复制child_jar.jar到chiptool项目libs目录,重新构建项目
      • 运行

    问题

    环境变量

    需要Android sdk、ndk,以及python环境

    • 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/
    

    遇到无法clone提示。

    fatal: 无法访问 'https://github.com/Qorvo/QMatter/':HTTP/2 stream 1 was not closed cleanly before end of the underlying stream
    fatal: 无法克隆 'https://github.com/Qorvo/QMatter' 到子模组路径 '/Users/wuyifan/code/android/connectedhomeip/third_party/qpg_sdk/repo'
    克隆 'third_party/qpg_sdk/repo' 失败。按计划重试
    

    fatal: 无法克隆 'xxx' 到子模组路径 'xxx',可以手动克隆到对应目录

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

    Setting up CIPD package manager...出现python报错

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

    更换网络或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.
    

    还有库没有下载,github搜索后git clone./third_party/指定目录

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

    安装ninja教程传送门,然后删除out目录下文件夹,缓存会影响下次编译

    提示kotlinc: command not found

    • 安装kotlin
    brew install kotlin
    

    相关文章

      网友评论

          本文标题:Android matter编译chiptool app

          本文链接:https://www.haomeiwen.com/subject/wuxuddtx.html