Android Studio comedy of errors

My goal is to learn enough about Android programming to code an adapter or bridge of some sort that allows an Android program to make use of my Java-based audio mixer and audio tools. To that end, I decided to install Android Studio on my newly made PC. But it’s taken close to a month to get the software to work! Last night I was finally able to run parts I & II of the tutorials provided at the Android site: successfully emulating a Nexus 5 which ran an app that displays the text “Hello world!”.

The last time I wrote about this, on the Chit-Chat Monster, I was complaining about “configuration hell” and getting the Emulator to work at all. I found out many JGO’ers also found the software difficult to install and make use of alternatives. So, maybe, maybe not, some notes on what went wrong and how it was solved will be useful?

  1. I think the decision to use Android-Studio instead of the Eclipse plug-ins for Android development is okay. This seems like a good way to keep this work segregated. I found switching between Eclipse workspaces to be clumsy. Also, having all the Android stuff seemed like clutter when I was just trying to do pure Java dev. But maybe it is just a matter of preference.

  2. It makes a difference if you are using an Intel cpu vs AMD. I suspect that at Google, most Android development is done on Intel cpu’s. The main reason I came to this conclusion: the easiest to find instructions recommend installing an Intel-made and provided tool for vm acceleration, and I believe it only supports Intel cpu’s. It is certainly possible to run Android Studio on AMD with acceleration, but you will have to go online to find “how-to’s” on blogs and StackOverflow, rather than being within the safe bounds of “official” instruction pages. (See #8 below.)

I built my computer with an AMD setup. I don’t regret this, but I could see where someone who wanted to do Android dev and was making a decision as to the cpu for their system might be advised to prefer Intel.

  1. I decided to install on Linux. My understanding was that Android dev was originally done on Linux, and the instructions for how to build the vm acceleration on Linux were less scary than for Windows 8.1. I am admittedly over my head here and may have gotten the wrong impression, but it seemed to me that, on Windows 8.1, the work-around for acceleration for the emulator compromises some of the graphics pertaining to the new tablets oriented GUI. I could easily be wrong on this, though. The decision was made pretty far back and I have forgotten most of the details.

Of course, if you are new to Linux, factor in an additional learning curve!

I decided to go with the current Ubuntu, 14.04.

  1. Partitioning for dual booting is a bit tricky. I decided to follow a tutorial that recommended having two partitions where there might more usually be one: one for “/” and one for “/home”. It seems there might be performance benefits, but again, I am speculating beyond my competence level. This split led to some complications which I will get to, but so far I think it was an okay decision. The main thing: many of the blogs are becoming more and more dated. Be sure to check the date, and maybe guestimate on the high side–the older blogs have size recommendations that are clearly too small for the current generation of computers and software. I figure the trend for sizing the partitions for the swap and for the “/” (if you go that route) will be to always increase over time.

5) You won’t be able to use Ubuntu’s built in software tools for installing Java. Android Studio requires Java 7, and Ubuntu is only providing Java 6. I ended up installing Java 7 from Oracle, in /usr/lib and it went okay. But, I’ve been reading that this might not have been the ideal choice. There was an article on where to install in the Ubuntu help areas, and I can’t recall where it is at the moment. It does exist, and in my scanning of it I noted that there was another /usr folder that might have been better. At this point, as long as it works, I’m not going to revisit the issue.
EDIT: just took a second look at Ubuntu Software Center and did a search for Java. OpenJDK 7 was on the list. My mistake.

  1. The directions for installing Android Studio and the Android SDK confused me. If starting again, I would simply put both on $HOME, in separate file folders. I made the mistake of setting one up on /usr/lib and the other at $HOME. Then, when running Android Studio, I found I had to use “sudo” as part of the command. This led to problems.

a) Files were being built in file folders in /root, and this was cramping the “/” partition, leading to system warnings about lack of disk space. Some of the files built there were the result of updates or installs, especially via the SDK Manager.

b) The .ini files built by the AVD Manager were ending up in /root and not visible to Android Studio.

It seems “sudo” (I am new to Linux/Ubuntu) changes the value of $HOME and/or some other environment variables that are used by Android, and the various sub-systems aren’t in synch on this. All this grief can be avoided by just installing everything on $HOME and making sure there is no need to use sudo when launching the application. (I ended up moving the /usr/lib install to $HOME, and then going to /root to remove two Android directories that were built there. Mucking around with /root is generally not recommended as it is a good way to totally wipe out your OS. It seems I was careful enough, though, this time.)

  1. If you are running a 64-bit OS, you will have to load a program for running 32-bit mode. The first web blogs I found that identify this problem recommend the use of a program (ia32-libs) that was dropped after Ubuntu 12. It took more digging but eventually found the replacement packages.

8.) I think (am not entirely sure) that you have to install the vm acceleration software in order for the AVD Manager to work and to be able to run emulations. I installed KVM. The basic overview on configuring VM acceleration on Linux is at the following site:

http://developer.android.com/tools/devices/emulator.html

Details on installing KVM can be found here:
https://help.ubuntu.com/community/KVM/Installation

To be honest, I’m not entirely clear if the Nexus 5 emulation I ran on my first tutorial made use of the acceleration or not. I’m going to have to review the process I went through in the AVD manager, and see if I did the steps spelled out in the first link above (under the heading “Configuring VM Acceleration on Linux”). (Late middle-age memory issues, compounded with minimal understanding. I did this somewhat earlier in the process of steps and the emulator fails I thought I was thus correcting may have been more about not having the 32-bit code runner working.)


Am very much looking forward to getting back to programming, proper.

??? :stuck_out_tongue: ??? :stuck_out_tongue: ???