More tools to create Mobile Applications - Open Source


Open Source, it sounds so good and it is. After all it distills the efforts of developers all around the world providing the results of their countless hours after office, weekends, etc to provide the world with a product and the source for those that would like to tweak/modify it themselves.
The tweet above summarizes my experience with most of the open-source projects and in fact one that took away valuable hours of my time prompted me to write this post.

The Dream

This ecosystem did not exist at all. A couple of years ago there was no multi-million dollar market with tablets and phones and apps. All developers look for that one silver bullet or lottery that they could strike to gain traction on the app store. While some developers keep working with low level tools using languages like Objective-C and C++ or C#, others look for alternatives that would provide a cross-platform experience that works across platforms using the same code base.

My experience is currently hovering with Lua, but once in a while it is fun to consider looking at other languages and frameworks. I came across this little gem called Kivy. It can create apps for the Desktop and the mobile from the same python source. It was an interesting proposition worth considering and looking into.

First Impressions


Downloaded the DMG file and installed it on the Mac. Started the Kivy.app to see NOTHING happen. The dock had the icon, but there was nothing working. Love (love2d.org) atleast displays the default animation to inform that it was not given any script to run, so that you are aware of the situation. Read somewhere that you can start an inteactive python prompt (Kivy) by typing kivy in a terminal. For those that know about Mac Apps, you cannot run the commandline app that easily, after all the appname.app is just a folder that contains the file inside. Then used the symlink creator program that comes with the Kivy Installation DMG. and could get an interactive console working. This app creates this symlink in /usr/local/bin which an average user might not be able to achieve, so using this utility is recommended.

Running a sample

The samples could be run by simply dragging the file.py onto the kivy icon. So far so good. Now what about the compiling the same for the Android? or any other system?

Compiling

This is where the Open Source hell splits open leaking all of it's guts and unwanted apps in your directories that you cannot as an ordinary user access and remove. You need to really know what you are doing before you can get down and dirty with the Terminal to remove packages from /usr/local/bin.

So first it said that you need buildozer a utility that helps create the spec file for building. Right that was easy, open up terminal and run a few commands, right?

1. Python comes standard with the Mac OSX (or I had definitely installed it). The requirements to get buildozer were to get pip. So first let's get pip; a simple python script file called get-pip.py this was saved to the hdd (source: http://www.pip-installer.org/en/latest/installing.html) then run python get-pip.py and this downloaded the tool.

2. Download buildozer using pip via the simple command sudo pip install buildozer

3. buildozer cannot do anything so you need to go to a directory with the source, (the file that starts your project up has to be called main.py) and run buildozer init this will initialise and create the spec file.

4. Run the buildozer command again, this time like buildozer android debug (though you can customize the spec file, changing the parameters as per your app) This will then check your system for the SDK, NDK, other tools and install them if they are not present or out of date. So while it downloaded the Android SDK and NDK on my system (AGAIN) I tried to build for the iOS. Before I could do that, the script complained that I did not have cython. sudo pip install cython was a quick resolution for that issue.

5. To build for the iOS the guts from Kivy have something called Kivy-iOS project on GitHub. So in Terminal cloned the Kivy-iOS project that went on to be a 80MB download. Before I could install, the readme states that I would need autoconf, automake, pkg-tool, libtool, mercurial installed. I had due to an earlier 'Open Source' project installed brew, I could simply run brew install autoconf automake pkg-config and they installed. Then it was to start the compilation of the tools using tools/build-all.sh as stated on the Kivy page here. It went on crying a couple of times and then said that there was no target specified to build hence nothing to do.

6. Realising that I might not need the tools and they are not compiling anyways and I have installed some crap that I might not use. All I might need is to run the script tools/create-xcode-project.sh and that would be all. First run, it complains about files not being present. The problem was that the script took the directory path from '$0' which is the path from where the script was run and append the template directory to this to look for the template files. The iOS project template is in a state of _____ (I do not have words to explain) a 10 year old kid had more files and a better organised project than this. The bridge files are missing and hence the script bails out complaining that these files are missing.


The issues clearly mention that the files are missing and the samples cannot be build for the iOS and that the xcode project is unusable and does not work, etc.

7. I gave up on the iOS and the Android compilation had completed by now and it told me that it wanted some __version__ information and was unable to find it. Even after setting that up, the Android compilation just did not work. So after all of this I could not get the iOS bit to work and nor the Android.

8. So let's build for the Mac OSX. The guide found here makes it look so simple and easy. What do I need, I just need to add pyinstaller. sudo pip install pyinstaller worked fine but where is this installed? so which pyinstaller quickly got me the details. In the guide it suggests that you go to the directory where pyinstaller resides. There is no directory called pyinstaller as it is in the /usr/local/bin directory and the pyinstaller.py script could not be found. So it was a simple pyinstaller test PATH this created the spec file which when modified did not work with pyinstaller as it needed kivy to be the running shell not plain python. It created the files and folders that looked like a Mac app but since it did not place the files properly, this did not run/execute.

9. Building for Windows, since this is running on a mac, it cannot generate the packages for Windows or Linux(which is not yet supported)

The point was that Kivy is such a cool framework, it has shaders, etc and all work quite well as can be seen in this 3D render sample.



It is a shame about this being totally unusable when it came to deploying software. One of the things that I have noticed over the years is that people do not like to tinker on the command line but would rather have a one button compile and link process. From the days of Turbo-C where you had to first compile then link from the command line, the DOS based IDE had the ability to Compile, Link and Run then (if memory serves me right) Alt+F5 allowed to vies the console and see the output of the running program. With Visual Studio (pre DotNet) and post DotNet press the Play button to compile and run the app, most IDE's on WIndows provided the green VCR Play button to compile and run. Xcode offers the same. However when the same is taken away and the user presented with huge long lists of specifications and settings, it makes the process unfriendly. Work with Eclipse and Java, you need to have Maven, Ant, Raven, what not. Why do I need that? Why are there so many of the same? Why can there not be one standard? Why do we have OpenSource projects doing the same thing over and over again rather than doing that one thing right and feature laden.

I had asked this question earlier and the only convincing answer to the question, "Why do OpenSource developers create so many new packages that do somewhat the same and confuse users" in a word was "EGO". It is all about the developers gratifying themselves. However I think there is more to that and yes while Ego is a major factor as directions in a project are determined by a few and features that become part or are left out are also determined by a few, the rest that get left behind are the ones that start a new project that includes just those features. In business that would be called finding the Gap, but unfortunately in this context it is only a distraction and an inconvenience.

What is the point of such a cool framework that does not compile. I mean prototypes for demo are used by classrooms however in the business world, if it cannot deliver, then it is off to the next shop.

Request


Does anybody have an idea of managing the xCode project workflow to compile from the terminal without having to open the xcode project, including creating the release version (not debug) and signing it with the appropriate developer signature all in one go and from one command line.


Suggestion

If there are developers that have time and want to make a mark on the dev community, then they should focus more on generic base tools that work for the masses rather than for the few that breathe the command line tools day-in and day-out. How about simple base framework that can be used for IDE's. Simple coding blocks that can integrate with any language. Code that allows the user to affix/map their own scripting language of choice with the C++ classes and so on.

OpenSource is good as it gets you the source code to have a peek into, but if the project does not compile or not work, what use is that source code, it is like looking into a vat of mixed paint to see what clear paint looks like - Impossible and a waste of time exercise.

Comments

Popular Posts