Skip to content Skip to sidebar Skip to footer

Phonegap - Building Phonegap Android App Gives Compile Error On Linux

I am getting error while building phonegap android app on my linux (ubuntu 12.04) machine. I have installed nodejs, set JAVA_HOME, ANT_HOME, ANDROID_HOME vars and $JAVA_HOME/bin, $

Solution 1:

you must

$cordova platform remove android

$cordova platform add android

because there is directory is missing in

platforms/android/cordova/node_modules/shelljs

or you can create another app and copy the missing file and add it in your app

Recently solution

in terminal go to your app then

cd platforms/android/cordova
sudo npm install shelljs

it's working fine with me

Solution 2:

I already installed shelljs:

sudo npm install shelljs -g

But I needed to set NODE_PATH

exportNODE_PATH=/usr/local/lib/node_modules

Not sure why it was missing...

Solution 3:

I have needed to update cordova-android engine (from 3.5.1) to 3.6.0 (because required by the splashscreen plugin, here)

To build the Android project (and evict the above errors), i have added in the package.json file (of my Cordova project root folder), the following npm dependencies:

"dependencies": {
    "q": "^1.2.0",
    "shelljs": "^0.4.0",
    "which": "^1.0.9"
  }

Solution 4:

I was getting the exact same error message on OS X 10.9 for my phonegap android app. The problem was that I set my JAVA_HOME variable incorrectly. Once it was correct, I needed to remove and add the android platform in cordova. It is possible that this may be your issue, so this is how I fixed it:

In my .zshrc file added the line export JAVA_HOME=$(/usr/libexec/java_home)

Finally I had to remove the platform and add it again in order for cordova to properly utilize java.

$cordova platform remove android

$cordova platform add android

Note: While troubleshooting, I installed the JDK, which may be necessary.

Solution 5:

I suggest you to ensure the required libs are installed running:

sudo npm install -g cordova gulp

Post a Comment for "Phonegap - Building Phonegap Android App Gives Compile Error On Linux"