1
votes

I'minstalled PhoneGap and made one simple app that works on my tablet when using PhoneGap server and PhoneGap App for android. Now I want to makean APK but I'm gatting error when runsudo phonegap build android in APP folder:

miljan@Miljan-PC:~/Desktop/HelloWorld$ sudo phonegap build android [sudo] password for miljan: [phonegap] executing 'cordova build android'... cp: no such file or directory: /home/miljan/Desktop/HelloWorld/icon.png

Running command: /home/miljan/Desktop/HelloWorld/platforms/android/cordova/build

[Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.]

ERROR building one of the platforms: Error: /home/miljan/Desktop/HelloWorld/platforms/android/cordova/build: Command failed with exit code 2 You may not have the required environment or OS to build this project

Error: /home/miljan/Desktop/HelloWorld/platforms/android/cordova/build: Command failed with exit code 2 at ChildProcess.whenDone (/usr/local/lib/node_modules/phonegap/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134:23) at ChildProcess.EventEmitter.emit (events.js:98:17) at maybeClose (child_process.js:743:16) at Process.ChildProcess._handle.onexit (child_process.js:810:5)

In ~/.profile I have add this:

export ANDROID_HOME=/home/miljan/Android-SDK-Linux
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platforms-tools

How I can slove this problem? Anyone who can help?

1
Anyone who can help?Miljan Ilic

1 Answers

1
votes

I had the same problem when I was using ionic to build android. I used this solution to solve my problem

Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.

use the third solution and don't use the exact paths which are given here. In the android_home give the path of your sdk. in the android_tools give the path of tools in the sdk and in the third give the platform path given in the sdk.

and if you have problem after this too userchmod 777 /sdk/tools and chmod 777 /sdk/tools/android.

May this solution helps