Introduction - What's this Android application doing in python project??
You may wonder why use Android application in python project??
Python project was from the beginning only one part of product that I wanted to create.
Second part was always the Android application that will gather data from GPS and show information about Endorphines Badges.
Prerequisites - Android-Studio
1. How to install Android Studio (on Ubuntu)
- Please download the Android Studio 2.3 (~429MB)
- Unpack files with
unzip android-studio-ide-162.3871768-linux.zip
- Install JRE if you have not yet done it by
sudo apt-get install -y default-jre && sudo apt-get install -y default-jdk
- If for some reason your default-jdk is below Android-Studio requirements, try to use this:
sudo add-apt-repository ppa:webupd8team/java -y
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java8-set-default
Check version:
java -version
- If you have already installed Java Runtime Environment (JRE) then after typing "sh android-studio/bin/studio.sh" you should see IDE start running.
- If after installing JRE you see error that says
No JDK found. Please validate either STUDIO_JDK, JDK_HOME or JAVA_HOME environment variable points to valid JDK installation
, don't panic.- Try changing
JDK_HOME system variable
to proper path of jdk i.e.JDK_HOME=/usr/java/jdk1.7.0.21/
- Try changing
2. Android introduction - how to start your first project
Take few minutes of your time and explore "Create an Android Projects" - This will give you the most basic information about how to startup first project with Android Studio.
3. What should be in your git-repository?
All your files that are project resources.
GitIgnore can be generated with gitignore.io i.e. for android, android-studio and intellij.
If you accidentally pushed build files, first do :
-
Gradle build:clean task - this will remove this files so you know what files are not-needed in
git status
-
use bfg repo cleaner as described here
-
commit and push cleaned commits to your remote repository
4. Why not use vi/vim and terminal for all your android-development ?
Well... you can certainly use vim for development, but vim-itself is not perfect IDE for the job. You should at least get yourself around some vim-plugins that could simulate some of the AndroidStudio behaviour, i.e. Gradle usage:
Final result
1. What I've created as initial?
-
Separated git repository available here.
-
Adding android application repository to main repository as a module
-
If you want to know how to do that, please follow this link - for those impatient, use
git submodule add GIT-LINK [optional directory to which clone repo]
. -
i.e.
git submodule add https://github.com/anselmos/Biking-Endorphines-Android-App androidapp
-
-
Initialized clean empty project for androidapp with minimum API 16(Android 4.1 - JellyBean) - since I've got one device that I'll use for tests and according to Google Play Store information about 95% of devices uses this minimum version of API.
-
Setup en Empty Activity for startup.
2. What are the plans for this android-sub-project?
-
Layout :
-
information about gps -is it on, active and properly initialized
-
starting and stopping/pausing button for biking activity
-
statistics mocked for this time, but eventually gathered from rest-api.
-
-
Start/Stop gathering data from gps as a GPX file format
-
Make Login-page that will login android-device in backend as a device-id, timestamp, user-id
-
Gather all information about statistics with endorphines-badges!
-
Presentation of Endorphines Badges with fun icons.
-
Divination - Tea-Leaf Reading for your biking-endorphines-badges - what you could do to gather more badges ! - based on analysis of bike-rides. - a pseudo AI for badges gathering
Code commits done for this post:
Tools and applications used:
- Android Studio
- VIM + Plugins (Fugitive, Vim-Markdown and Vimux )
- Docker
- Tmux
LL (Lessons Learned)
1. I've added git submodule in a bad way.
Initially I've added android application to project repository in a bad way - I've forgot to add directory path to which submodule should be cloned.
So I've decided to run rm -rf
on git-submodule files and the gitsubmodule
config file.
Unfortunatelly when I tried to use git add submodule
again, I've crossed at error like this :
A git directory for '[HERE GOES NAME OF DIRECTORY]' is found locally with remote(s):
The problem was almost identical as described at stackoverflow
Solution:
I needed to remove .git/submodule/[Directory-containing-submodule]
to make git forget about my first attempt to clone submodule.
Comments
comments powered by Disqus