GigaCoder
GigaCoder

Reputation: 251

Unknown host CPU architecture: arm64 2022 Macbook Air M1

I cannot resolve this error, even though it is mentioned as resolved here in M1.

Unknown host CPU architecture: arm64 , Android NDK SiliconM1 Apple MacBook Pro

My error code.

[CXX1405] error when building with ndkBuild using /Users/adamheinrich/Desktop/android-solocoo-2.0/Solocoo/app/src/main/jni/Android.mk: Build command failed. Error while executing process /Users/adamheinrich/Library/Android/sdk/ndk/20.1.5948944/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/Users/adamheinrich/Desktop/android-solocoo-2.0/Solocoo/app/src/main/jni/Android.mk NDK_APPLICATION_MK=/Users/adamheinrich/Desktop/android-solocoo-2.0/Solocoo/app/src/main/jni/Application.mk APP_ABI=arm64-v8a NDK_ALL_ABIS=arm64-v8a NDK_DEBUG=1 APP_PLATFORM=android-22 NDK_OUT=/Users/adamheinrich/Desktop/android-solocoo-2.0/Solocoo/app/build/intermediates/cxx/Debug/x2j681s3/obj NDK_LIBS_OUT=/Users/adamheinrich/Desktop/android-solocoo-2.0/Solocoo/app/build/intermediates/cxx/Debug/x2j681s3/lib APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n} ERROR: Unknown host CPU architecture: arm64

After editing ndk-build with text editor I have. enter image description here

What else can I do? How can I install .dmg beta ndk? It is not available in SDK Manager via Android Studio.

Also after editing this file my OS says it is corrupted/ damaged. How can I edit it properly?

Upvotes: 1

Views: 3558

Answers (1)

GigaCoder
GigaCoder

Reputation: 251

Using Sublime Text editor instead of Macbook text editor allowed me to edit it without corrupting it. Edit ndk-build file in Library/Android/sdk/ndk to:

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

Upvotes: 5

Related Questions