I am trying to build an Android application by executing Gradle from a PHP script using exec()
, but there is no response, so I am unable to see why the build fails.
When executing the applications gradle wrapper from the terminal (SSH), the whole process works fine, using the following commands:
x:/path/to/project/$ ./gradlew assembleRelease
x:/path/to/project/$ ./gradlew assembleRelease --debug --stacktrace
x:/path/to/project/$ ./gradlew assembleRelease --debug --stacktrace > output.txt
The output works fine and I am able to troubleshoot any possible problems. When executing gradle from a PHP-script, there is no output.
// array for the output to be dumped into
$output_array = array();
// $result is empty (tried with stacetrace, debug and an output file)
$result = exec("cd /path/to/project && ./gradlew assembleRelease", $output_array);
// nothing displayed
var_dump($output_array);
There is no way of me telling where the problem is. I have checked that the required environment variables ($GRADLE_HOME
and $ANDROID_HOME
) are set using getenv()
and they point to the correct path.
Any help would be great!