3

Once the phonegap installation is done, I created a phonegap project and try to build it. I get below error.

username@userpc:~/phonegap/testapp$ cordova build
cp: no such file or directory: /home/username/phonegap/testapp/icon.png

Running command: /home/username/phonegap/testapp/platforms/android/cordova/build 

/home/username/phonegap/testapp/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                          ^
Error: ENOENT, no such file or directory '/home/username/android-sdk-linux/tools/tools/lib/build.template'
    at Object.fs.openSync (fs.js:432:18)
    at Object.fs.readFileSync (fs.js:286:15)
    at /home/username/phonegap/testapp/platforms/android/cordova/lib/build.js:120:40
    at _fulfilled (/home/username/phonegap/testapp/platforms/android/cordova/node_modules/q/q.js:798:54)
    at self.promiseDispatch.done (/home/username/phonegap/testapp/platforms/android/cordova/node_modules/q/q.js:827:30)
    at Promise.promise.promiseDispatch (/home/username/phonegap/testapp/platforms/android/cordova/node_modules/q/q.js:760:13)
    at /home/username/phonegap/testapp/platforms/android/cordova/node_modules/q/q.js:574:44
    at flush (/home/username/phonegap/testapp/platforms/android/cordova/node_modules/q/q.js:108:17)
    at process._tickCallback (node.js:415:13)
ERROR building one of the platforms: Error: /home/username/phonegap/testapp/platforms/android/cordova/build: Command failed with exit code 8
You may not have the required environment or OS to build this project

When I run phonegap build it gives me below output but the application does not work.

username@userpc:~/phonegap/testapp$ phonegap build
[phonegap] executing 'cordova build'...
[phonegap] completed 'cordova build'

How can I fix this?

Techie
  • 44,706
  • 42
  • 157
  • 243

1 Answers1

6

First of all, you have to decide whether you want to stick to Phonegap or Cordova CLI. Don't mix them both, this will only get you into trouble. If you need support for the proprietary Phonegap-Build-Service provided by Adobe, you will need Phonegap, otherwise you can use Cordova.

If you want to stick to Phonegap, create a project with phonegap create <project>, add the android platform (phonegap platform add android) and then build it using phonegap build android.

I'm guessing you didn't properly setup the path variables for the Android SDK, because it is looking for the build template in path '/home/username/android-sdk-linux/tools/tools/lib/build.template'.

I suggest you set the path variables like described in another post here.

Community
  • 1
  • 1
qefzec
  • 1,360
  • 1
  • 13
  • 13