 <p>Running gradle with the --info flag to determine the command being run:</p> <pre><code>gradlew :app:compileHello-jniArm64- v8aDebugAllSharedLibraryHello-jniMainC --info </code></pre> <p>In the output you should see a command containing <code>aarch64-linux-android-gcc -dM -E -</code> with a full path. Check that you do actually have this binary at the path shown (it should have been included in the android ndk).</p> <p>Assuming you do, try running the command yourself. It will read from stdin and print a bunch of constants to stdout (gradle is trying to parse the version from this), but you want to see stderr:</p> <pre><code>echo '' | ./aarch64-linux-android-gcc -dM -E - 1&gt;/dev/null </code></pre> <p>If the command fails, an error should be shown which can hint at the problem. In my case it was trying to include a folder <code>4.9.x</code> but I had a folder named <code>4.9</code>. Most likely there will be a different problem with your setup.</p>