-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Errors using php-android-cli on fedora linux #4
Comments
@Iolaum: hi,
changed the Actually this script is developed in I'll modify the script ASAP for user-friendly methods. May be till that time you can use that script from Thanks |
Thank you for the reply. Am a little busy with other stuff atm but will test your suggestion when I can. |
The newline problem is still not fixed. What is the purpose to add the shebang intended for *NIX systems and not to make it actually work? |
Moreover, it applies also to the files that it generates, which makes the project a kind of viral, in a bad sense. |
And also no |
check commit which reverted back the issue of new line. Just fork and replace
You can generate your own My suggestions: Fork the repo, edit/update according to your needs, then recompile it as Regards |
Any progress here? Just hit the same problem.. does anyone have a fixed clone? |
This fork works on Ubuntu LTS, just tried the project creation using index.php. Please try yourself, build the phar - execute phar to create project - use gradle to build the project. If you have any issues - comment here. |
Hi, sorry for the inconvenience. Check the latest release. Thanks |
@Iolaum I know your issue was a couple years ago, but I found both the cause of this, and a solution for myself - I posted the issue here on this github repo (I hadn't noticed your post at that point in time, because the issue was closed and I only looked at open issues) Briefly, the problem is that the stub file has Windows line endings, so when the phar archive is executed on linux, it interprets the shebang line literally as What I did (after trying several options, such as hexediting the phar) was simply to build the archive myself from source on my own linux box; its very simple to do, and the author has created In the issue I created (issue #8) , I have listed all the steps and commands I used to fix this. In summary, they are:
These are just a summary of the steps I took. Takes about ~5 mins, and the detailed steps with commands you need are listed in issue #8 |
@bodqhrohro @xandro0777 you're asking if there is any update for this? The quick answer is, not yet, but I found an easy work-around, if you're still interested in using the tool. I raised an issue for this error, issue #8 and detailed my work around - I have to say, once you fix this annoying bloody bug, the tool is quite amazing! In hindsight, it was well worth my time investigating the bug - what else is vacation time for, other than fixing other peoples bugs? 😠 🤣 |
Hey @Iolaum @bodqhrohro and @xandro0777 I just created a bash script to automate the work-around, so all you have to do is download the script and run it. https://github.com/Nos78/php-android-cli/blob/master/tasks/fix-phpandroid.sh This script:
Why do we need the source code zip? The compiled binary does not include the |
#!/usr/bin/bash
#
# Script to fix the line endings issue with https://github.com/AnandPilania/php-android-cli/
# Issue can be found at:
# - https://github.com/AnandPilania/php-android-cli/issues/4
# - https://github.com/AnandPilania/php-android-cli/issues/8
#
# This script:
# + downloads the v1.0.0 binary of phpandroid.phar (which has incorrect line endings for linux execution)
# + downloads the v1.0.0 source code (zip) for the above binary
# + extracts the vendor folder from the binary
# + re-builds the phpandroid.phar archive from source
# + cleans up!
echo -e "\033[93m *** This script creates a temporary folder, fix-phpandroid, in your home directory and downloads \033[0mphpandroid.phar (v1.0.0) binary release & its source code \033[93mfrom the official github repository at \033[94mhttps://github.com/AnandPilania/php-android-cli\n"
echo -e "\033[93mThis script relies upon the following being available:\033[0m\n * wget (\033[93musually installed by default on most Linux boxes\033[0m)\n * phar (\033[93mthis is part of phpV.X-common\033[0m; if you have php, you should have phar)\n\033[0m * unzip (\033[91mnot \033[93musually installed by default - use the pkg manager to install)\033[0m\n sudo apt install unzip\n sudo yum install unzip \033[93metc, use the pkg man for the flavour you use\n\n\033[91mPlease ensure you have these before continuing to execute this script.\033[0m"
read -p "Press any key to continue, or CTRL+C to quit"
mkdir ~/fix-phpandroid
cd ~/fix-phpandroid
wget https://github.com/AnandPilania/php-android-cli/releases/download/v1.0.0/phpandroid.phar
phar extract -f phpandroid.phar extracted
# clean up - don't need the broken binary any more
rm phpandroid.phar
wget https://github.com/AnandPilania/php-android-cli/archive/refs/tags/v1.0.0.zip
unzip v1.0.0.zip
mv extracted/vendor php-android-cli-1.0.0/.
rm v1.0.0.zip
cd php-android-cli-1.0.0
# Correct the version number, so we know in future that this is a modified binary, not an official release:
sed -i -e 's/v1.0.0/v1.0.99/g' index.php
sed -i -e 's/Console App/Console App [self build]/g' index.php
cd tasks
php generate_phar.php
mv phpandroid.phar ~/.
cd ../../..
# final clean up
rm -rf fix-phpandroid
echo -e "\n\033[93m *** All temporary files and folders created by this script have been deleted, including the two downloaded ones.\n\033[0m"
chmod +x ~/phpandroid.phar
echo -e "\n\033[93m *** Re-build phpandroid.phar successful.\033[0m \033[91mThe binary can be found in your home directory $HOME/phpandroid.phar. Execute permission bit has been set\033[0m:"
ls ~/phpandroid.phar -la
echo -e "\n\033[93m *** Running command line: \033[0m~/phpandroid.phar -V\n\033[91mIf the following reads \033[0m'Console App [self build] \033[92mv1.0.99\033[90m'\033[91m then the bug is fixed and your new phpandroid.phar is ready and waiting to be put into /usr/bin/ or wherever you want to put it!\033[0m"
~/phpandroid.phar -V |
Its literally one line 😆 |
@AnandPilania wrote:
You might like this: having just tested my theory, the irony is if you use Unix file endings, the windows version still works fine (unless there is something weird if you run windows in a VM) |
Thanks, I will have another look at it. I think I have already gotten that far to build it myself and fix the line endings, however my original goal - to use it with an older version of ruboto (one that doesn't require android studio to build) unfortunately didn't work with that.
|
Thanks for looking into this. unfortunately I no longer trying to build android apps so I am not using this library. |
I tried to use the project but encountered the following errors:
After some googling I found this SO answer so I did:
and tried again:
at which point I gave up.
Environment details:
The text was updated successfully, but these errors were encountered: