Thursday, January 23, 2014

Issues concerning Computer Systems for Android Development

There are many choices to be made when you decide that you want to start developing programs for Android devices. Perhaps the first choice that you probably have made already is what operating system you will be using to develop on.  It seems a bit ironic, but to my knowledge there are no Android based systems (other than web browser based systems) that are currently capable of developing software to run on Android itself.  After you gain an understanding how Android works under the hood you will understand that it is unlikely that any development system will ever be viable running on Android. Most likely the next generation will involve something like a Chrome operating system linked to a cloud based development system and I wouldn't be surprised if that happens soon due to the explosive growth in cloud computing. So here are your choices: Windows, Mac or Linux. I have done development on Windows and on Linux but not on a Mac system. if you are looking for advice on a Mac system you are in the wrong place. When it comes to Windows, I used to develop in Windows a few years ago and it worked OK but I became frustrated with the way Microsoft was dealing with the Bluetooth stack which is a pretty obscure issue for most but for me it was a 'deal breaker'.  I now proudly tell head hunters "I don't do Windows".

The issues that I am going to discuss will apply equally to both Windows and Linux based systems. A frequent question that I get is "which distro do I use"?  I have had experience on multiple distributions of Linux and I have seen them rise to prominence and fall from prominence based more on their business model than their features. The truth be known is they all run on a 'kernal" which is the actual operating system under the hood.  Think of it as they all have the same horse and they each have their own buggy hooked to it. So they each will work as development platform the only things that will change will be software package mangers and the like. And just like every other operating systems updates occur at a regular basis and as matter of convenience you want a distribution that is easy to update without disturbing your development system. I currently use Ubuntu 12.04 LTS and the LTS stands for long term support.  Their business model as far as I know is based on selling support to companies that use their distribution and they seem to be quite stable. Software updates are almost automatic in that they will show up as being available and you have to allow them to happen. Ubuntu uses a user interface called Unity and it takes a little getting used to but I have grown accustomed to it.

The only caveat I have is that when upgrading to a whole new version I have run into some compatibility issues and I have in the past had to downgrade to an earlier version in order to get everything working again. Be very wary of getting the latest version of anything without knowing whether it is fully working.  Case in point there is JDK 7 out but you may have problems with compatibility with some areas.  If you are just starting out go with what the masses are using.

There are a few choices for a Integrated Development Environment out there but the standard is currently based on Eclipse. Eclipse is a wonderful and powerful IDE but the problem is it takes a lot of "horse power" (remember my horse and buggy analogy)  The other problem is it is downright intimidating when you first see it.  There are so many features and settings that by the time you learn them all you will have at least forgotten a few.  Don't be fearful because for every feature that Eclipse has there are probably three tutorials on the internet showing their use. When you realize that you can't remember everything you will discover it is more important where to look when you want to do something. One nice feature of the Unity interface on Ubuntu is the ability to have four desktop workplaces to switch to and from at the click of a mouse. It is very handy to a browser open to a tutorial and then the Android SDK in another.

So here is the problem: You want get into developing Android but you don't want spend the five to six hundred bucks for a new computer that will have enough "horse power" to make your ride enjoyable. I use a "beater" laptop that I bought used more than two years ago and it was year old at that time. Somewhere there is a derivative to Moore's Law that states as computers become more advanced they will consume more resources. I am cheap because I am poor. I don't spend anything unless I have to. Yes, I would like to be able to fork out $1000 on a new computer that would make my life a little easier but I can't afford to.  I know that there are a lot of people that are looking to learn Android in order to improve their lives and so I am writing this in order help you make the most of you what you have.

If you are reading this chances are you already have a computer and you are considering setting up a development system.  I recommend that you assess your computer by examining it in detail. How much memory do I have? How many slots for memory does the motherboard have? What microprocessor does it have? Is the microprocessor Intel or AMD?  Is the microprocessor 32bit or 64bit? How many cores does it have? How many threads can it run? What kind of hard drive do I have? How fast is the hard drive? For the uninitiated, these questions might seem quite difficult. Do not fear because the answers to all of those questions are easily answered by searching the internet. 

First lets talk about your microprocessor. Go to your system settings and look for the processor and memory installed.  Next open a browser and Google the exact description for the microprocessor as it appears on your system settings. Scroll through the results until you see a spec sheet from the manufacturer.  Take note of how many cores (more is better), how many threads (more is better) and whether it is 32bit or 64bit. Surprisingly, the clock speed is one of the least important specs since most processors run in the GHz range.  A single core processor running at 1.5 GHz is not as good as a dual core multi-threaded processor running at 1.2 GHz.

Now lets talk about your motherboard. Look for the name and model number of your computer and type them into the Google machine with word 'specifications' or 'manual' after it. Scroll through the results and find a manual and look for the maximum supported memory and how many memory slots it has. What you want to answer is can I expand the memory and how cheap can I get by? On my computer 1GB was OK until I upgraded the operating system. I went ot 2GB and it helped a lot.  My system is limited to 2GB without flying outside the box. When it comes to developing Android you can't have too much memory. So in my case the computer had two slots and 1GB of memory installed so I ordered two 1GB sticks to upgrade to 2GB. How did know that both slots were in use? Manufacturers are cheap, they would rather put two smaller sticks instead of one larger stick because they could save a buck or two. Beside that you should always match the memory when you are upgrading. If one is rated at 300Mhz and another at 600 Mhz and your system is compatible with the 600 MHz stick it will run at the 300 Mhz speed in order to accommodate the slower memory. Memory will be your cheapest upgrade so splurge.

Next lets talk about 32bit versus 64bit microprocessors. Both will work but they will use different versions of the operating system in order to take advantage of the more modern 64bit processors. The bottom line is that you get what you have in the computer. It is rarely, if ever feasible to upgrade to a 64 bit processor on a motherboard that has a 32bit processor. The only advantage that I see with Intel versus AMD when it comes to Android is that Intel has the HAXM virtualization stuff going on that is supposed to significantly speed up the emulator in the Android SDK. I haven't seen the equivalent for AMD. (even though it may exist)  The bottom line is I have to do without since my system is 32bit. My next system will be 64bit Intel unless things change by the time I upgrade.

Another bottleneck you system will encounter is the hard drive. It turns out that the size of the hard drive has become a great selling point but is not really that important. Yes, you need some room but the amount of storage you have isn't as important as to how fast you can retrieve it or store it. In Ubuntu you can use the disk utility to see what kind of hard drive you have along with everything else you might be interested in. It includes a self test routine and a speed test (read only if the drive is mounted). 

My hard drive was acting suspiciously so I opted to replace it with a Solid State Drive. Without going into too much detail the old hard drive relied on spinning discs of magnetic memory and the new hard drive is really just static memory chips arranged to look like a hard drive to my system. I bought a 64Gb replacement and swapped it out and re-installed everything.  The old hard drive averaged 23 MBsec and the new one about 65 MBsec.  The difference was very significant in everything I do on the computer and it was well worth the $75 bucks I spent. Be forewarned that Solid State Drives are a work in progress and mine has already crashed twice and the manufacturer is not exactly easy to work with.  I ordered a 64Gb thumb drive and I plan to clone the hard drive automatically every night.  Yes, I would like to have one that was more reliable but my system won't support the more modern drives from reputable manufacturers.

Unfortunately the standard backup routines don't really back up your entire system. I have used the program 'dd' before in order to clone drives automatically  so I am hoping that the problem goes away as the hard drive maps away its bad sectors. In the mean time I will have a fresh clone to restore everything to its last running state. Annoying yes, but it is a lot easier to reclone it than it is to re-install  the operating system. One job takes minutes and the other involves hours. Besides that you can always boot to the clone in a pinch. 

In conclusion, upgrade your memory and consider switching to a solid state drive.

Update: I tried reformatting my rescue USB stick with an updated version of 12.04 (so I wouldn't have 512 updates)  and it wouldn't boot.  I switched to 13.10 and had success so I installed it to my SSD.  I had to re-install Chrome and had to use the version from Ubuntu. I also had to re-install the OpenJDK6-jre. The android SDK them worked so far.  You have to enable workspace switching in appearances in 13.10.

Found a problem after upgrading to Ubuntu 13.10
There is a work around in the article that works but not exactly as expressed (for me). I have the menus working and it is too much work to go back. Found the problem only after building an 8Gb usb 2.0 drive that has an entire development system on  the 8Gb stick.  It works but there was very little space left. I recommend at least 16Gb and I don't recommend it as your main system.  I built it as an emergency boot to copy (using dd) a 64 Gb image over to my SSD in case it fails again. Just for entertainment I wanted to see if I could fit the entire development system on the 8 Gb stick.  Answer Yes but only about 250 Mb to spare. By the way you have to install Chrome by downloading it manually  and installing via apt (search web for instructions)and definitely not by the Ubuntu Software manager. 
The bottom line is the new release comes with free bugs.

No comments:

Post a Comment