Giter Site home page Giter Site logo

anandpilania / php-android-cli Goto Github PK

View Code? Open in Web Editor NEW
20.0 4.0 9.0 229 KB

Create Android-Studio gradle project from CLI with PHP... (created for personal use)

License: MIT License

PHP 100.00%
android-app php cli gradle scaffolding skeleton android-cli php-cli

php-android-cli's Issues

shebang incorrect in v1.0.0 causes CLI console error

The latest release v1.0.0 causes a console error when trying to run phpandroid.phar

I downloaded the latest release, and placed it in /usr/bin as phpandroid, then tried to run it in a bash shell:

    noscere@bertram:~$ phpandroid
    /usr/bin/env: ‘php\r’: No such file or directory

A simple hexedit of the phpandroid.phar shows that the hashbang/shebang line has windows type file endings 0D0A /r/n (instead of just 0A or /n) and so it is interpretting the shebang as #!/usr/bin/env/php\r instead of #!/usr/bin/env php.

Unfortunately (for me) I couldn't just hexedit the line ending, changing it to 0A0A (cannot remove a byte, only change it, so effectively this adds a blank line with a unix line-ending character) because that breaks the SHA1 file signature.

I also tried to phar extract the archive and re-pack it with phar pack -b '#!/usr/bin/env php' -f phpandroid.phar * but this does not even insert a shebang at all? (again, viewing with hexedit shows no shebang where there should be one). In the end I downloaded the source and re-compiled my own binary using cd tasks && php generate_phar.php, which added the shebang correctly formatted with proper line ending.

For curiosity-sake, I delved into the code of phar.phar; the section which adds/modifies the hashbang is adding '/n' to the line if a new-line is not present; so I can only assume that the release was built on a windows machine and the /usr/bin/env php line at the top of stub.php had the wrong line ending?

Directory creation not working in Linux

When the app creates the files it doesn't create a proper directory, it just generates individual files with the names of the paths they are supposed to be in,names such as "Project\app\src\main\AndroidManifest.xml".

Edit: I used the latest release phar file. I think latest changes in your code are not reflected in your latest release.

Errors using php-android-cli on fedora linux

I tried to use the project but encountered the following errors:

# Downloaded phpandroid.phar put in a folder inside $PATH and made it executable
$ phpandroid.phar create NewPipeC org.schabi.newpipe
/usr/bin/env: ‘php\r’: No such file or directory

After some googling I found this SO answer so I did:

$ tr -d '\15' < phpandroid.phar > phpandroid
$ chmod u+x phpandroid

and tried again:

$ phpandroid create NewPipeC org.schabi.newpipe
PHP Fatal error:  Uncaught PharException: phar "/home/iolaum/.local/bin/phpandroid" SHA1 signature could not be verified: broken signature in /home/iolaum/.local/bin/phpandroid:4
Stack trace:
#0 /home/iolaum/.local/bin/phpandroid(4): Phar::mapPhar()
#1 {main}
  thrown in /home/iolaum/.local/bin/phpandroid on line 4

at which point I gave up.

Environment details:

$ php -v
PHP 7.3.10 (cli) (built: Sep 24 2019 09:20:18) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.10, Copyright (c) 1998-2018 Zend Technologies
$ lsb_release -a
LSB Version:	:core-4.1-amd64:core-4.1-noarch
Distributor ID:	Fedora
Description:	Fedora release 30 (Thirty)
Release:	30
Codename:	Thirty

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.