Amal P Mathew
Amal P Mathew

Reputation: 11

Cause: error=1, Operation not permitted showing after modifying NDK build file for fixing CPU architecture: arm64 issue on M1 Apple MacBook Pro

Once I got the following error :

Unknown host CPU architecture: arm64

, Android NDK Silicon M1 Apple MacBook Pro

I did the following solution from stack overflow (https://stackoverflow.com/a/69555276/18491169):

Finder -> Go To Folder(/Users/mac/Library/Android/sdk/ndk/21.4.7075529) -> now edit ndk-build open it in text editor and paste below code script and re-run your project.

from

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

to

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

After this NDK build file modification, I'm getting another error saying :

Cause: error=1, Operation not permitted

Upvotes: 1

Views: 725

Answers (1)

Yuki Matsuda
Yuki Matsuda

Reputation: 1

I solved this problem (Cause: error=1, Operation not permitted) by re-installing NDK. In my case, I used a different version of the old NDK (16.1.4479499).

  1. uninstall NDK
    Tools -> SDK Manager -> SDK Tools
    uncheck "NDK (side by side)"
    click "Apply"
  2. reinstall NDK
    check "NDK (side by side)" again
    click "Apply"
  3. copy old NDK to ~/Library/Android/sdk/ndk/16.1.4479499
  4. edit ndk-build again
  5. build again

Upvotes: 0

Related Questions