Skip to content
Advertisement

Build gradle assemble apk using laravel function

I’m currently calling the main python file in larval function, and inside that main python file I’m calling another 2 files ( PowerShell and sub python file) the problem is when the Laravel function is triggered it only call the main python file, however when I call the main python file using terminal all the files are executed like below:

Laravel function:

JavaScript

and within the main python file I have:

JavaScript

Edit:

now I changed the build to be direct from laravel function to generate the apk using this command:

JavaScript

however, the command line returns the Gradle command build is starting but it doesn’t create a folder and generate the apk

the Current folder structure /var/www/html and inside html is the project folder and laravel project

note: before I call Gradle build command inside Laravel function, I used to call python file and that python file is calling Gradle command but I had the same issue the apk is not created, but when I run the same python file from bash command it works fine

Advertisement

Answer

There are 2 ways you can accomplish this:

The first is to include your commands into a .sh file that you should make it executable using this command:

chmod +x file.sh

Then you should call that file from laravel using Symfony process so you can get details of the log process and errors:

use SymfonyComponentProcessProcess; use SymfonyComponentProcessExceptionProcessFailedException;

JavaScript

Then include all commands in that file you wish to run.

Second you can run those commands using

JavaScript

You’ll need to move all your writable files into public directory in Laravel, because that’s where everything should be editable.’=

I actually suggest the first one as you don’t need to change owner of some folders to www-data to give write permissions.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement