title: ionic build android failed - compileDebugJavaWithJavac
body: <p>This is my very first project using ionic 1.7.16. When I run <strong>ionic build android</strong> on my mac, I get the error below.</p>
  
  <p>Tried deleting ~/.cordova/lib/npm_cache, but it didn't help</p>
  
  <p>android platform target is 22</p>
  
  <p>The app was built using the following tutorials, which runs fine when I use ionic serve</p>
  
  <ul>
  <li>part 1:
  <a href="http://www.joshmorony.com/integrating-google-maps-with-an-ionic-application/" rel="nofollow">http://www.joshmorony.com/integrating-google-maps-with-an-ionic-application/</a></li>
  <li>part 2:
  <a href="http://www.joshmorony.com/part-1-using-the-http-service-in-ionic-to-dynamically-load-google-map-markers/" rel="nofollow">http://www.joshmorony.com/part-1-using-the-http-service-in-ionic-to-dynamically-load-google-map-markers/</a></li>
  <li>part 3:
  <a href="http://www.joshmorony.com/part-3-advanced-google-maps-integration-with-ionic-and-remote-data/" rel="nofollow">http://www.joshmorony.com/part-3-advanced-google-maps-integration-with-ionic-and-remote-data/</a></li>
  </ul>
  
  <p>During the app dev, I run the following commands:</p>
  
  <pre><code>ionic start ionic-maps blank
  ionic setup sass
  ionic platform add ios
  ionic platform add android
  bower install ngCordova
  cordova plugin add cordova-plugin-geolocation
  cordova plugin add cordova-plugin-network-information
  ionic serve
  </code></pre>
  
  <p>ionic build android errors</p>
  
  <pre><code>    MacBook-Pro:ionic-maps XYZ$ ionic build android
  Running command: /Users/XYZ/projects/madpaws/ionic/ionic-maps/hooks/after_prepare/010_add_platform_class.js /Users/XYZ/projects/madpaws/ionic/ionic-maps
  add to body class: platform-android
  ANDROID_HOME=/Users/XYZ/Library/Android/sdk
  JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
  :preBuild UP-TO-DATE
  :preDebugBuild UP-TO-DATE
  :checkDebugManifest
  :CordovaLib:preBuild UP-TO-DATE
  :CordovaLib:preDebugBuild UP-TO-DATE
  :CordovaLib:compileDebugNdk UP-TO-DATE
  :CordovaLib:compileLint
  :CordovaLib:copyDebugLint UP-TO-DATE
  :CordovaLib:mergeDebugProguardFiles UP-TO-DATE
  :CordovaLib:packageDebugRenderscript UP-TO-DATE
  :CordovaLib:checkDebugManifest
  :CordovaLib:prepareDebugDependencies
  :CordovaLib:compileDebugRenderscript UP-TO-DATE
  :CordovaLib:generateDebugResValues UP-TO-DATE
  :CordovaLib:generateDebugResources UP-TO-DATE
  :CordovaLib:packageDebugResources UP-TO-DATE
  :CordovaLib:compileDebugAidl UP-TO-DATE
  :CordovaLib:generateDebugBuildConfig UP-TO-DATE
  :CordovaLib:generateDebugAssets UP-TO-DATE
  :CordovaLib:mergeDebugAssets UP-TO-DATE
  :CordovaLib:processDebugManifest UP-TO-DATE
  :CordovaLib:processDebugResources UP-TO-DATE
  :CordovaLib:generateDebugSources UP-TO-DATE
  :CordovaLib:compileDebugJavaWithJavac/Users/XYZ/projects/madpaws/ionic/ionic-maps/platforms/android/CordovaLib/src/org/apache/cordova/CordovaInterfaceImpl.java:222: error: cannot find symbol
          getActivity().requestPermissions(permissions, requestCode);
                       ^
    symbol:   method requestPermissions(String[],int)
    location: class Activity
  /Users/XYZ/projects/madpaws/ionic/ionic-maps/platforms/android/CordovaLib/src/org/apache/cordova/CordovaInterfaceImpl.java:228: error: cannot find symbol
          getActivity().requestPermissions(permissions, requestCode);
                       ^
    symbol:   method requestPermissions(String[],int)
    location: class Activity
  /Users/XYZ/projects/madpaws/ionic/ionic-maps/platforms/android/CordovaLib/src/org/apache/cordova/CordovaInterfaceImpl.java:233: error: cannot find symbol
          if(Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.M)
                                                         ^
    symbol:   variable M
    location: class VERSION_CODES
  /Users/XYZ/projects/madpaws/ionic/ionic-maps/platforms/android/CordovaLib/src/org/apache/cordova/CordovaInterfaceImpl.java:235: error: cannot find symbol
              int result = activity.checkSelfPermission(permission);
                                   ^
    symbol:   method checkSelfPermission(String)
    location: variable activity of type Activity
  /Users/XYZ/projects/madpaws/ionic/ionic-maps/platforms/android/CordovaLib/src/org/apache/cordova/CordovaActivity.java:493: error: method does not override or implement a method from a supertype
      @Override
      ^
  Note: Some input files use or override a deprecated API.
  Note: Recompile with -Xlint:deprecation for details.
  5 errors
  
   FAILED
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Execution failed for task ':CordovaLib:compileDebugJavaWithJavac'.
  &gt; Compilation failed; see the compiler error output for details.
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
  
  BUILD FAILED
  
  Total time: 3.779 secs
  Error: Error code 1 for command: /Users/XYZ/projects/madpaws/ionic/ionic-maps/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/XYZ/projects/madpaws/ionic/ionic-maps/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
  </code></pre>