title: Android native implementation throws make: ***No rule to make target
body: <p>This is my first native implementation android app, which I followed online tutorial with some tweaks to fit my needs. I found a lot of SO answers to the above error but none of them worked for me. 
  I added ndk-build to my environment variables. Yet I get I get this when I execute ndk-build from the command line.</p>
  
  <pre><code>C:\Users\AndroidStudioProjects\myapp\app\src\main\jni&gt;ndk-build
  Android NDK: APP_PLATFORM not set. Defaulting to minimum supported version android-14.
  Android NDK: WARNING: APP_PLATFORM android-14 is higher than android:minSdkVersion 1 in C:/Users/AndroidStudioProjects/myapp/app/src/main/AndroidManifest.xml. NDK binaries will *not* be comptible with devices older than android-14. See https://android.googlesource.com/platform/ndk/+/master/docs/user/common_problems.md for more information.
  make: *** No rule to make target `C:/Users/AndroidStudioProjects/myapp/app/src/main/jni/libglimage.c', needed by `C:/Users/AndroidStudioProjects/myapp/app/src/main/obj/local/arm64-v8a/objs/glimage-jni/libglimage.o'.  Stop.
  </code></pre>
  
  <p>When I execute ndk-build from android studio terminal I get </p>
  
  <pre><code>C:\Users\AndroidStudioProjects\myapp\app\src\main\jni&gt;ndk-build
  'ndk-build' is not recognized as an internal or external command,
  operable program or batch file.
  </code></pre>
  
  <p>When I build suing gradle, I get the following</p>
  
  <pre><code>make: *** No rule to make target `C:/Users/AndroidStudioProjects/myapp/app/src/main/jni/libglimage.c', needed by `C:/Users/AndroidStudioProjects/myapp/app/build/intermediates/ndkBuild/release/obj/local/armeabi/objs/glimage-jni/libglimage.o'.  Stop.
  process_begin: CreateProcess(NULL, "", ...) failed.
  Error while executing process C:\Users\AppData\Local\Android\sdk\ndk-bundle\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\Users\AndroidStudioProjects\myapp\app\src\main\jni\Android.mk APP_ABI=armeabi NDK_ALL_ABIS=armeabi NDK_DEBUG=0 APP_PLATFORM=android-19 NDK_OUT=C:/Users/AndroidStudioProjects/myapp/app/build/intermediates/ndkBuild/release/obj NDK_LIBS_OUT=C:\Users\AndroidStudioProjects\myapp\app\build\intermediates\ndkBuild\release\lib APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}
  Build command failed.
  make: *** No rule to make target `C:/Users/AndroidStudioProjects/myapp/app/src/main/jni/libglimage.c', needed by `C:/Users/AndroidStudioProjects/myapp/app/build/intermediates/ndkBuild/debug/obj/local/armeabi/objs-debug/glimage-jni/libglimage.o'.  Stop.
  process_begin: CreateProcess(NULL, "", ...) failed.
  C:/Users/AppData/Local/Android/sdk/ndk-bundle/build//../prebuilt/windows-x86_64/bin/echo.exe "directory C:/Users/AppData/Local/Android/sdk/ndk-bundle/build//../sysroot C:/Users/AndroidStudioProjects/myapp/app/src/main/jni C:/Users/AppData/Local/Android/sdk/ndk-bundle/build//../sources/cxx-stl/system" &gt;&gt; C:\Users\AndroidStudioProjects\myapp\app\build\intermediates\ndkBuild\debug\lib/armeabi/gdb.setup
  C:/Users/AppData/Local/Android/sdk/ndk-bundle/build//../prebuilt/windows-x86_64/bin/echo.exe "set solib-search-path C:/Users/AndroidStudioProjects/myapp/app/build/intermediates/ndkBuild/debug/obj/local/armeabi" &gt; C:\Users\AndroidStudioProjects\myapp\app\build\intermediates\ndkBuild\debug\lib/armeabi/gdb.setup
  C:/Users/AppData/Local/Android/sdk/ndk-bundle/build//../prebuilt/windows-x86_64/bin/echo.exe [armeabi] "Gdbsetup       ": "C:\Users\AndroidStudioProjects\myapp\app\build\intermediates\ndkBuild\debug\lib/armeabi/gdb.setup"
  copy /b/y "C:\Users\AppData\Local\Android\sdk\ndk-bundle\build\\..\prebuilt\android-arm\gdbserver\gdbserver" "C:\Users\AndroidStudioProjects\myapp\app\build\intermediates\ndkBuild\debug\lib\armeabi\gdbserver" &gt; NUL
  C:/Users/AppData/Local/Android/sdk/ndk-bundle/build//../prebuilt/windows-x86_64/bin/echo.exe [armeabi] "Gdbserver      ": "[arm-linux-androideabi] C:\Users\AndroidStudioProjects\myapp\app\build\intermediates\ndkBuild\debug\lib/armeabi/gdbserver"
  md "C:\Users\AndroidStudioProjects\myapp\app\build\intermediates\ndkBuild\debug\lib\armeabi" &gt;NUL 2&gt;NUL || rem
  Error while executing process C:\Users\AppData\Local\Android\sdk\ndk-bundle\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\Users\AndroidStudioProjects\myapp\app\src\main\jni\Android.mk APP_ABI=armeabi NDK_ALL_ABIS=armeabi NDK_DEBUG=1 APP_PLATFORM=android-19 NDK_OUT=C:/Users/AndroidStudioProjects/myapp/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=C:\Users\AndroidStudioProjects\myapp\app\build\intermediates\ndkBuild\debug\lib APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}
  Build command failed.
  External Native Build Issues
  </code></pre>
  
  <p>These are the contents of my Application.mk and Android.mk respectively
      /***/</p>
  
  <pre><code>APP_PLATFORM := android-14
  APP_ABI := all
  
  /***/
  
  LOCAL_PATH := $(call my-dir)
  include $(CLEAR_VARS)
  LOCAL_MODULE := libglimage-jni
  LOCAL_SRC_FILES := libglimage.c
  include $(BUILD_SHARED_LIBRARY)
  </code></pre>
  
  <p>The following is partial code of my Java class</p>
  
  <pre><code>public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
          nativeSetSurface(holder.getSurface());
      }
  
      public void surfaceCreated(SurfaceHolder holder) {
      }
  
      public void surfaceDestroyed(SurfaceHolder holder) {
          nativeSetSurface(null);
      }
  
  
      public static native void nativeOnStart();
      public static native void nativeOnResume();
      public static native void nativeOnPause();
      public static native void nativeOnStop();
      public static native void nativeSetSurface(Surface surface);
  
      /*static {
          System.loadLibrary("nativeegl");
      }*/
      static {
          System.loadLibrary("libglimage");
      }
  </code></pre>
  
  <p>This is my build.gradle content. As you can see minsdkVersion is higher that 14 opposite of what the ndk-build is spitting on me.</p>
  
  <pre><code>android {
      compileSdkVersion 26
      buildToolsVersion "26.0.2"
      defaultConfig {
          applicationId "mypackage"
          minSdkVersion 19
          targetSdkVersion 26
          versionCode 1
          versionName "1.0"
          testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
  
          ndk {
              moduleName "libglimage"
              ldLibs "log", "android", "EGL", "GLESv1_CM"
          }
      }
  
      externalNativeBuild {
          ndkBuild {
              path 'src/main/jni/Android.mk'
          }
      }
  
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
  }
  
  dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
          exclude group: 'com.android.support', module: 'support-annotations'
      })
      compile 'com.android.support:appcompat-v7:26.+'
      compile 'com.android.support.constraint:constraint-layout:1.0.2'
      testCompile 'junit:junit:4.12'
      compile files('libs/Vuforia.jar')
  }
  </code></pre>
  
  <p>Please help if you can figure out what is going on. </p>