Monday, May 6, 2013

[android help] php can't run command about android

php can't run command about android - Stack Overflow







Tell me more ×

Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

















I would like to create an android project in PHP. I hv wrote a .bat file for PHP to execute:



cd C:\temp
android create project -n test -t 1 -p ./testing -k com.examples.test -a Main
exit


(I have tested that these commands are workable if I just type them in cmd.exe.)


However, if I use PHP to run the .bat file with following code:



system("test.bat"); ?>


It will be no response at all. Is PHP not able to execute any command about "android"? or any better solution for creating project in PHP?


Thank you.





























*.bat file is not a binary executable. I think it can be executed only by system's shell like *.doc file can be opened only by sofware that supports it.


To execute *.bat file you need to execute it via shell's cmd.exe



system("cmd.exe /c test.bat");






















Where is your test.bat file is placed in the file system? The code you are supplied is trying to run it from a root of disk C:.






















I have tried to run a create.bat before and it ran well with this code :


system("c:\wamp\www\android\bin\create.bat /PF\ c:\wamp\www\test com.example.test mytest");


============================================ But my problem was that the server couldn't recognize the Android SDK PATH ("Environment variable") and so it gave me this error :



=================================================== I have tried to run other .bat files that didn't need any of the last requirements and they ran perfect ... hope anyone can solve my environment variable problem




















lang-php






.

stackoverflow.comm

No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...