Sunday, September 6, 2015

9-06-2015 Get Kivy to make an android app on my phone using Dalvik (status: done)

Unfortunately my phone won't upgrade to 5.0 so I can use ART. I think once I fix my phone i will switch to ART. The reason is that I am probably a year away from really using it in prod, and a year from now most everything will have ART. I don't care about apple products for cost reasons and target audience.

The nice thing is I might be able to write a program that runs on a phone, tablet, Linux, Windoze, and iOS. It is not going to be an intensive program.


sudo add-apt-repository ppa:kivy-team/kivy
  # I want python2, I hate python3
sudo apt-get install python-kivy

sudo apt-get install kivy-examples # didn't work

  #Had to remove ffmpeg. On Linut Mint, hope it doesn't make a difference compared to ubuntu. 
sudo apt-get install -y     python-pip     build-essential     mercurial     git     python     python-dev          libsdl2-dev     libsdl2-gfx-dev     libsdl2-image-dev     libsdl2-mixer-dev     libsdl2-net-dev     libsdl2-ttf-dev     libportmidi-dev     libswscale-dev     libavformat-dev     libavcodec-dev     zlib1g-dev

sudo pip install --upgrade pip virtualenv setuptools


virtualenv --no-site-packages kivyinstall

  ## I guess this puts us in the virtual environment. 
. kivyinstall/bin/activate

pip install Cython==0.21.2
pip install kivy


pip install git+https://github.com/kivy/buildozer.git@master
pip install git+https://github.com/kivy/plyer.git@master
pip install -U pygments docutils


  # We need to know where the examples are. 
python -c "import pkg_resources; print(pkg_resources.resource_filename('kivy', '../share/kivy-examples'))"

# Even though the output was: /root/kivyinstall/local/lib/python2.7/site-packages/kivy/../share/kivy-examples
# my path was : /root/kivyinstall/share/kivy-examples/
ln -s /root/kivyinstall/share/kivy-examples kivy-examples
cd kivy-examples
cd demo/touchtracer
python main.py

cd ../pictures
python main.py

   # Dumb I am root, but this is a test box. 
   # This makes it so the beginning of the scripts can be #!/usr/bin/kivy
ln -s /root/kivyinstall/bin/python /usr/bin/kivy



Packaging for android
git clone https://github.com/kivy/buildozer.git
cd buildozer
sudo python2.7 setup.py install


buildozer init
buildozer android debug deploy run

git clone git://github.com/kivy/python-for-android
./distribute.sh -m "pil openssl kivy"



Had to do some work on apache and git on my local box when pushing to production.
Locally:

  • cd /var/www/html/
  • rm index.html
  • mkdir DIR
  • chown work DIR
  • In the apache config: /etc/apache2/sites-enabled/000-default.conf
    • <Directory "/var/www/html/hhcf/">
      AddHandler cgi-script .cgi .py
      AllowOverride All
      Options +Indexes +FollowSymLinks +ExecCGI
      Order allow,deny
      Allow from all
      </Directory>
  • a2enmod cgi a2enmod status a2enmod info
  • Restart apache
For git I created a bash script to save stuff quickly. I don't care about comments because its all me. I just called it "G" with chmod 755 /usr/local/bin/G.


#!/bin/sh

echo $1
git add $1 
git commit -m "auto"
git push origin master





No comments:

Post a Comment