在linux服务器部署Alaxe Voice Service环境时。
遇到了这个问题,在此做个记录,其他老铁应该能绕过这个坑。
在windows系统中遇到的,基本也是这么个情况,只是Android Studio 提供了相对方便的管理器,可以随便搜两下解决。
但本质都是配置出了问题,处理方法类似。
工程缺少local.properties
因local.properties这个文件,是默认没有上传到git远程仓库。
在以下2款路径下,新建local.properties
,并输入你对应AndroidSDK、NDK路径
1、alexa-auto-sdk/platforms/android/modules
2、alexa-auto-sdk/samples/android/modules/sample-core
#你的NDK的路径,前提是你本地必须下载了指定的SDK,具体命令查看下面的【引申】
ndk.dir=/opt/sdk/android-sdk-linux/ndk/20.0.5594570
#你的SDK路径,如:
sdk.dir=/opt/sdk/android-sdk-linux
问题发生过程:
执行alexa-auto-sdk/builder$ ./build.sh android -t androidarm64 --android-api 22
时,报
~/alexa-auto-sdk/platforms/android/modules ~/alexa-auto-sdk/builder
> Configure project :addressbook
----------------------------------------------------------
Extracting the abi 'arm64-v8a' from 'arm64-v8a-android-22'
----------------------------------------------------------
WARNING: Compatible side by side NDK version was not found. Default is 20.0.5594570.
Compatible side by side NDK version was not found. Default is 20.0.5594570.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':addressbook'.
> NDK not configured. Download it with SDK manager. Preferred NDK version is '20.0.5594570'. Log: /alexa-auto-sdk/platforms/android/modules/addressbook/.cxx/ndk_locator_record.json
如果在Android Studio中,导入一个工程,local.properties
会自动创建,但是Android SDK和NDK未必会指定。
链接:在 CentOS 7 下构建 Android 编译环境
假设 ANDROID_HOME 路径是 /opt/sdk。安装过程如下。
//通过 sdkmanager 来安装一些组件。一条命令一步到位。如下。
$ mkdir -p /opt/sdk && cd /opt/sdk
$ wget https://dl.google.com/android/repository/commandlinetools-linux-6609375_latest.zip
$ unzip -q commandlinetools-linux-6609375_latest.zip
$ rm -fv commandlinetools-linux-6609375_latest.zip
$ export PATH=/opt/sdk/tools/bin:$PATH
$ [ -z "${ANDROID_HOME}" ] && export ANDROID_HOME=/opt/sdk
$ yes | sdkmanager --sdk_root=${ANDROID_HOME} --licenses
$ sdkmanager --sdk_root=${ANDROID_HOME} "platform-tools" "platforms;android-30" "platforms;android-29" "ndk-bundle" "ndk;21.0.6113669" "build-tools;29.0.2"
完成后,确认已安装的列表。
$ sdkmanager --sdk_root=${ANDROID_HOME} --list
返回
Installed packages:
Path | Version | Description | Location |
---|---|---|---|
build-tools;29.0.2 | 29.0.2 | Android SDK Build-Tools 29.0.2 | build-tools/29.0.2/ |
ndk-bundle | 21.3.6528147 | NDK | ndk-bundle/ |
ndk;21.0.6113669 | 21.0.6113669 | NDK (Side by side) 21.0.6113669 | ndk/21.0.6113669/ |
patcher;v4 | 1 | SDK Patch Applier v4 | patcher/v4/ |
platform-tools | 30.0.3 | Android SDK Platform-Tools | platform-tools/ |
platforms;android-29 | 4 | Android SDK Platform 29 | platforms/android-29/ |
platforms;android-30 | 1 | Android SDK Platform 30 | platforms/android-30/ |
tools | 2.1.0 | Android SDK Tools 2.1 | tools/ |
Available Packages:
以下省略