title: Cordova fails to build project
body: <p><strong>Update:</strong> new readers, check my last edit please.</p>
  <p>After updating cordova, it fails to buld/run</p>
  <pre><code>Mac-mini-de-Toni:funcook toniweb$ sudo cordova build
  Password:
  Running command: /Users/toniweb/Proyectos/cordova/funcook/platforms/android/cordova/build 
  ANDROID_HOME=/usr/local/Cellar/android-sdk/22.6.2
  JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
  Running: /Users/toniweb/Proyectos/cordova/funcook/platforms/android/gradlew cdvBuildDebug -b /Users/toniweb/Proyectos/cordova/funcook/platforms/android/build.gradle -Dorg.gradle.daemon=true
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  A problem occurred configuring root project 'android'.
  &gt; Could not resolve all dependencies for configuration ':_debugCompile'.
     &gt; Could not find any version that matches com.android.support:support-v4:+.
       Searched in the following locations:
           https://repo1.maven.org/maven2/com/android/support/support-v4/maven-metadata.xml
           https://repo1.maven.org/maven2/com/android/support/support-v4/
       Required by:
           :android:unspecified
  
  * 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: 9.374 secs
  
  /Users/toniweb/Proyectos/cordova/funcook/platforms/android/cordova/node_modules/q/q.js:126
                      throw e;
                            ^
  Error code 1 for command: /Users/toniweb/Proyectos/cordova/funcook/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/toniweb/Proyectos/cordova/funcook/platforms/android/build.gradle,-Dorg.gradle.daemon=true
  ERROR building one of the platforms: Error: /Users/toniweb/Proyectos/cordova/funcook/platforms/android/cordova/build: Command failed with exit code 8
  You may not have the required environment or OS to build this project
  Error: /Users/toniweb/Proyectos/cordova/funcook/platforms/android/cordova/build: Command failed with exit code 8
      at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:139:23)
      at ChildProcess.EventEmitter.emit (events.js:98:17)
      at maybeClose (child_process.js:753:16)
      at Process.ChildProcess._handle.onexit (child_process.js:820:5)
  </code></pre>
  <p>I checked that I have the target 22 installed which is set in the project.properties</p>
  <pre><code># This file is automatically generated by Android Tools.
  # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
  #
  # This file must be checked in Version Control Systems.
  #
  # To customize properties used by the Ant build system edit
  # &quot;ant.properties&quot;, and override values to adapt the script to your
  # project structure.
  #
  # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
  #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
  # Project target.
  target=android-22
  android.library.reference.1=CordovaLib
  cordova.system.library.1=com.android.support:support-v4:+
  </code></pre>
  <p>Any idea what I missing? (this was working fine before updating cordova)</p>
  <p>-UPDATE-</p>
  <p>Plugins:</p>
  <pre><code>Mac-mini-de-Toni:funcook toniweb$ cordova plugins list
  org.apache.cordova.camera 0.3.6 &quot;Camera&quot;
  org.apache.cordova.device 0.3.0 &quot;Device&quot;
  org.apache.cordova.file 1.3.3 &quot;File&quot;
  org.apache.cordova.inappbrowser 0.6.0 &quot;InAppBrowser&quot;
  org.apache.cordova.media 0.2.16 &quot;Media&quot;
  org.apache.cordova.media-capture 0.3.6 &quot;Capture&quot;
  </code></pre>
  <p>cordova platform update android:</p>
  <pre><code>Mac-mini-de-Toni:funcook toniweb$ cordova platform update android
  Updating android project...
  cp: copyFileSync: could not write to dest file (code=EACCES):/Users/toniweb/Proyectos/cordova/funcook/platforms/android/assets/www/cordova.js
  
  ls: no such file or directory: /Users/toniweb/Proyectos/cordova/funcook/platforms/android/libs/cordova-*.jar
  
  Android project updated with cordova-android@4.1.1
  </code></pre>
  <p>Versions:</p>
  <pre><code>Mac-mini-de-Toni:funcook toniweb$ npm version
  { http_parser: '1.0',
    node: '0.10.28',
    v8: '3.14.5.9',
    ares: '1.9.0-DEV',
    uv: '0.10.27',
    zlib: '1.2.3',
    modules: '11',
    openssl: '1.0.1g',
    npm: '1.4.9' }
  
  
  
  
  Mac-mini-de-Toni:funcook toniweb$ node --version
  v0.10.28
  
  
  
  Mac-mini-de-Toni:funcook toniweb$ cordova -v
  5.3.3
  </code></pre>
  <p>And this:</p>
  <pre><code>android list sdk
  </code></pre>
  <p>will prompt me to the java's download page, Which I installed and then rebooted, and still prompt me the same</p>
  <p><code>No Java runtime present, requesting install. No Java runtime present, requesting install.</code></p>
  <p>-EDIT-</p>
  <p>By installing a <a href="http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html" rel="nofollow noreferrer">jdk</a> this last thing doesn't happen anymore</p>
  <p>-EDIT-</p>
  <p>By installing a jdk I can build and run cordova android only if I use <code>sudo</code> otherwise looks like same error</p>