title: `create` script for Cordova Android fails to create new project - errors with java/ant configuration
body: <p>I'm trying to create a new Android project using Cordova/Phonegap.</p>
  
  <p>I have downloaded cordova-2.9.0, and the ADT Bundle for Mac.</p>
  
  <p>I extracted ADT to ~/Developer/Android, and added it to my PATH:</p>
  
  <pre><code>export PATH="$HOME/Development/Android/sdk/tools:$PATH"
  export PATH="$HOME/Development/Android/sdk/platform-tools:$PATH"
  </code></pre>
  
  <p>I then try to run the cordova <code>create</code> script, but it fails:</p>
  
  <pre><code>→  bin  sudo ./create ~/Projects/myproject/cordova-android com.mydomain.myproject myproject
  Password:
  
  BUILD FAILED
  /Users/asgeo1/Development/Android/sdk/tools/ant/build.xml:714: The following error occurred while executing this line:
  /Users/asgeo1/Development/Android/sdk/tools/ant/build.xml:728: Compile failed; see the compiler error output for details.
  
  Total time: 1 second
  An unexpected error occurred: ant jar &gt; /dev/null exited with 1
  Deleting project...
  </code></pre>
  
  <p>Not very helpful.  So I edit the Cordova <code>create</code> script so it will output some more information.</p>
  
  <pre><code>    # COMMENTED OUT piping to /dev/null:
      #
      # compile cordova.js and cordova.jar
      pushd "$BUILD_PATH"/framework # &gt; /dev/null
      ant jar #&gt; /dev/null
      popd  #&gt; /dev/null
  </code></pre>
  
  <p>Then I re-ran the <code>create</code> script:</p>
  
  <pre>
  →  bin  sudo ./create ~/Projects/myproject/cordova-android com.mydomain.myproject myproject
  ~/Downloads/cordova-2.9.0/cordova-android/framework ~/Downloads/cordova-2.9.0/cordova-android/bin
  Buildfile: /Users/asgeo1/Downloads/cordova-2.9.0/cordova-android/framework/build.xml
  
  -pre-build:
  
  -check-env:
   [checkenv] Android SDK Tools Revision 22.0.5
   [checkenv] Installed at /Users/asgeo1/Development/Android/sdk
  
  -setup:
       [echo] Project Name: Cordova
    [gettype] Project Type: Android Library
  
  -build-setup:
  [getbuildtools] Using latest Build Tools: 18.0.1
       [echo] Resolving Build Target for Cordova...
  [gettarget] Project Target:   Android 4.3
  [gettarget] API level:        18
       [echo] ----------
       [echo] Creating output directories if needed...
       [echo] ----------
       [echo] Resolving Dependencies for Cordova...
  [dependency] Library dependencies:
  [dependency] No Libraries
       [echo] ----------
       [echo] Building Libraries with '${build.target}'...
     [subant] No sub-builds to iterate on
  
  -code-gen:
  [mergemanifest] No changes in the AndroidManifest files.
       [echo] Handling aidl files...
       [aidl] No AIDL files to compile.
       [echo] ----------
       [echo] Handling RenderScript files...
  [renderscript] No RenderScript files to compile.
       [echo] ----------
       [echo] Handling Resources...
       [aapt] No changed resources. R.java and Manifest.java untouched.
       [echo] ----------
       [echo] Handling BuildConfig class...
  [buildconfig] Generating BuildConfig class.
  
  -pre-compile:
  
  -compile:
      [javac] Compiling 104 source files to /Users/asgeo1/Downloads/cordova-2.9.0/cordova-android/framework/bin/classes
      [javac] /Users/asgeo1/Downloads/cordova-2.9.0/cordova-android/framework/src/com/squareup/okhttp/Connection.java:171: method does not override a method from its superclass
      [javac]   @Override public void close() throws IOException {
      [javac]    ^
  </pre>
  
  <p>And there's another 40 errors like the one above, regarding <code>@override</code>.</p>
  
  <p>From what I can tell on Google, this is because in jdk 1.6 and above, the @override annotations changed. (or something like that):
  <a href="https://stackoverflow.com/questions/2335655/why-is-javac-failing-on-override-annotation">Why is javac failing on @Override annotation</a></p>
  
  <p>OK, so I work out that the Android SDK configuration for <code>ant</code> is in a file called <code>build.xml</code>. Low and behold, it has some settings for Java 1.5:</p>
  
  <pre><code>&lt;property name="java.target" value="1.5" /&gt;
  &lt;property name="java.source" value="1.5" /&gt;
  </code></pre>
  
  <p>If I change those values to 1.6 or 1.7, I get a java error when re-running the Cordova <code>create</code> script:</p>
  
  <pre><code>-compile:
      [javac] Compiling 104 source files to /Users/asgeo1/Downloads/cordova-2.9.0/cordova-android/framework/bin/classes
      [javac] javac: invalid source release: 1.7
      [javac] Usage: javac &lt;options&gt; &lt;source files&gt;
  </code></pre>
  
  <p>I'm really scratching my head here. I'm not an expert on Java, so I don't get what is going on here.</p>
  
  <p>Does anyone know how to run the <code>create</code> script for Cordova Android on OSX ?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>After following @cartland's advice below I was able to get rid of the <code>@Override</code> errors. Still getting one last error though:</p>
  
  <pre><code>-compile:
  [javac] Compiling 104 source files to /Users/asgeo1/Downloads/cordova-2.9.0/cordova-android/framework/bin/classes
  [javac] /Users/asgeo1/Downloads/cordova-2.9.0/cordova-android/framework/src/org/apache/cordova/InAppBrowser.java:523: error: cannot find symbol
  [javac]                 settings.setPluginsEnabled(true);
  [javac]                         ^
  [javac]   symbol:   method setPluginsEnabled(boolean)
  [javac]   location: variable settings of type WebSettings
  [javac] Note: Some input files use or override a deprecated API.
  [javac] Note: Recompile with -Xlint:deprecation for details.
  [javac] 1 error
  </code></pre>
  
  <p>I'll try and work out what that is - but if anyone knows, please post an answer :)</p>
  
  <p><strong>UPDATE 2</strong></p>
  
  <p>I know what the 2nd error is. It's mentioned here: <a href="https://developer.motorolasolutions.com/thread/3640" rel="nofollow noreferrer">https://developer.motorolasolutions.com/thread/3640</a></p>
  
  <p>Cordova 2.9.0 is not compatible with Android SDK 18. I need to use Cordova 3.0.0 with Android SDK 18. (or conversely downgrade the Android SDK to 17)</p>