1

I'm using PhoneGap in my graduation project which finishes after approximately one month. I need in my project to create two PhoneGap applications (Android & IOS) from within a PHP webpage. I'm using the command line as PhoneGap community said and everything is ok on Windows I can create Android project (for sure not IOS because it's only on Mac). However, recently I moved all my work to MAC Pro laptop and prepared PhoneGap environment and tested it perfectly working. What has shocked me is that when I'm trying to create Android project from PHP page it's not working and gives me this error

**An unexpected error occurred:

ANDROID_BIN="${ANDROID_BIN:=$( which android )}" exited with 1 Deleting project…**

Whereas if I copy the same command using in PHP to MAC terminal it's working perfectly. Also what has shocked me is that creating IOS app has no problem. I asked and searched a lot on the Internet but I can't find exactly what I need and honestly I can't understand the problem. (What is different between using exec() in PHP and terminal in MAC ?).

Also related to the above error after some search I found someone said that you need to configure the create file in android/bin. I did that and the above problem fixed but appear a new one said that's you need to download Android version even that I have one. I'm Android developer by the way and what makes me stop changing the create file that's from terminal working which means no problem in create file.

Regards.

mmvsbg
  • 3,570
  • 17
  • 52
  • 73
  • Try running the commands with the `-d` flag, which should give you more log messages when there are errors and help track down your problems. It seems to me from reading this is that you don't have the Android SDK installed and configured properly on the MAC. Did you add both the `tools` and `platform-tools` folders to your PATH? Did you download the latest version of the SDK? If API 19 is out but you only have API 18, I think it will error and tell you to get the latest version. – MBillau Jan 16 '14 at 21:29
  • thanks for your fast reply, yes i added them. i can't understand how the environment or android SDK not found but from terminal found ? this will kill me. ok i will try to put -d and check errors. thanks in advance. – Ahmad Abo Rjelah Jan 16 '14 at 21:41
  • I'm not really a linux/mac person but I'm guessing when you use PHP's `exec()` it's not a full "shell" and not really exposing everything that is available to the commands in `terminal`... Try reading through this and I think it'll help: http://stackoverflow.com/questions/3428647/php-exec-path-variable-missing-elements – MBillau Jan 16 '14 at 21:55
  • Yes man thank you it approx. solve the problem, when i echo the $PATH from PHP it's different from one on the terminal so i configure it also from PHP before creating phonegap application. but now appear another one related to no android SDK found. i think the solution stand in the same area of previous one related to different processes between PHP & terminal. – Ahmad Abo Rjelah Jan 17 '14 at 11:06
  • Yeah I think it's probably the same issue. When you echo PATH in PHP you should see the path to `java jdk`, `ant`, android's `tools` and `platform-tools`, and probably `git` and `npm`. – MBillau Jan 17 '14 at 13:57

0 Answers0