MAC M1 ndk-build ERROR: Unknown host CPU architecture: arm64

前言

最近来了一批MAC M1的设备作为打包机,从老的mac里拷贝了数据过去,但一些环境还是存在差异

比如

问题

配置ndk的环境目录后,执行ndk-build,报错提示

ERROR: Unknown host CPU architecture: arm64

好吧,直接是不支持m1架构

解决方法

vi编辑ndk-build

将里面的内容从

#!/bin/sh
DIR="$(cd "$(dirname "$0")" && pwd)"
$DIR/build/ndk-build "$@"

修改成

#!/bin/sh
DIR="$(cd "$(dirname "$0")" && pwd)"
arch -x86_64 /bin/bash $DIR/build/ndk-build "$@"

重新运行验证

MacBook-Pro ~ % ndk-build
Android NDK: Could not find application project directory !    
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.

ok,ndk-build可以正常发挥作用了

你可能感兴趣的:(android,android,mac)