user2219190
user2219190

Reputation: 157

Why does my phonegap build android command not work?

i am new to phonegap 3 and android development.

i tried the command "phonegap build android" and get:

[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] adding the Android platform...
   [error] An error occured during creation of android sub-project.
fs.js:427
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^
Error: ENOENT, no such file or directory 'C:\Users\Michael\.cordova\lib\android\
cordova\3.1.0\VERSION'
    at Object.fs.openSync (fs.js:427:18)
    at Object.fs.readFileSync (fs.js:284:15)
    at Object.exports.createProject (C:\Users\Michael\.cordova\lib\android\cordo
va\3.1.0\bin\lib\create.js:116:22)
    at Object.<anonymous> (C:\Users\Michael\.cordova\lib\android\cordova\3.1.0\b
in\create:34:12)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)

Upvotes: 2

Views: 7650

Answers (5)

chank
chank

Reputation: 3636

I have removed android platform and added again.

cordova platform rm android cordova platform add android

then, cordova prepare android

is done without errors

Upvotes: 0

Markenson Fran&#231;a
Markenson Fran&#231;a

Reputation: 489

I simply add an empty file named as VERSION:

C:\Users\myuser\.cordova\lib\android\cordova\3.1.0\VERSION

after, I wrote this text inside it:

3.1.0 

after, run phonegap again:

[phonegap] adding the Android platform...
[phonegap] compiling Android...
[phonegap] successfully compiled Android app

Good luck!

Upvotes: 3

Dano007
Dano007

Reputation: 1932

I would suggest as a bare minimum first step you should check via the command line that the following commands return a response that shows they are working correctly. They are all required. Ant - http://ant.apache.org/

Java -http://www.oracle.com/technetwork/java/javaee/downloads/java-ee-sdk-6u3-jdk-7u1-downloads-523391.html

android - http://developer.android.com/sdk/index.html

In command line type the following to validate they work

Ant

java

android

Make sure you have node.js installed (http://nodejs.org/) Also make sure you look at you PATH file and that everything is correct there.

As I say that's the basics (once you have stuff installed)

Upvotes: 1

Leo
Leo

Reputation: 1505

It is kind of tricky This is the sequence I have to go through.

  1. run a clean in eclipse (Project Menu)
  2. sudo phonegap build android (cordova if that is what you are using)
  3. then you have to reapply the read write permissions to the whole folder (this step may not be needed depending on your permissions)
  4. then in eclipse run refresh on the project
  5. then build.
  6. Run

Upvotes: 1

Igor Konoplyanko
Igor Konoplyanko

Reputation: 9374

Try to install latest cordova. Maybe it will help:

$ sudo npm install -g cordova

(also you will need node.js installed)

Upvotes: 0

Related Questions