2016/12/05

Why I tried Android Studio first, and how I got on.

As I mentioned in my previous post, I have a 3 neuron brain, and I require clarity and simplicity to get anywhere in my thought processes.

Android and Android Studio seemed to me a good choice because everything was already set up. I just had to write the program, let Studio create the APK, and count the groats from the Android app store, or play shop or game supermarket or whatever it is called.





I was also attracted by the tutorials, there seemed to be a good place, developer.android.com, where I could follow step by step lessons in creating apps. It seemed to me that there was a one stop shop for writing, debugging, delivering and monetizing mobile apps. It was that in the end which decided me.

Xamarin lost because of the huge download, and JavaScript + HTML + Cordova lost because the tutorials I found seemed less appetising. Depending on how Android Studio goes I may come back to either or both of these.

So I downloaded and installed Android Studio, it took several hours, but seemed to go without problems, apart from a component download which failed, which it re-downloaded automatically without any prompting from me. I guess the whole download was about a fifth of the Xamarin one (which I never finished).

Once installed I noticed it seemed very very slow, especially compared to what I was used to with Visual Studio 2015.

Anyway I went here https://developer.android.com/training/basics/firstapp/index.html to learn how to write my first app with Android Studio.

You have to enable Developer Options in your device (smartphone or tablet)  if you want to be able to send APK files from Android Studio to it. If you can't see Developer Options under Settings go into the About Phone and tap the Build Number 7 times.  Developer Options is sometimes hidden by default, hence the 7 tap system to make sure it is only activated if you really really know what you are doing. Or at least think you know what you are doing.

All went well until I tried to load the program onto my Lenovo tablet. It is oldish, but I had selected the lowest Android OS (JellyBean I think it was) as the target of my simple app. Android Studio could not see the device:




"No USB devices or running emulations detected." Hmmm. I tried a phone, still same problem. I had to change USB socket. Then it worked. Compared with the first USB I used, the second working one was USB 2.0. Maybe that was the problem.

So. Voila.



You can just about see Hello World at top left.

The next lesson was about using an emulator to run your APK on a virtual Android device. I followed the steps and got to the final screen:



It was confusing because although Finish was not greyed out clicking on it did nothing. Casting my eyes around the dialog I see a "recommendation." A recommendation...what's that? A bit of advice?

"VT-x is disabled in BIOS" Hmmm. Is it? Do I care?

Will it run anyway? I mean. Maybe there is software emulation (which I thought this was) and fiddling with the BIOS will just make it run faster...? I mean, a recommendation is not an error is it? Yes it is.

I've never come across this ever before, but you need to enable hardware emulation in the BIOS before you can run the (software?) emulation of an Android device. Well if that it true the emulation must run really fast...!

I had to restart my computer three times before I found out which thing to click on the BIOS to enable virtualization, as it is called. On my machine it is this button:



I had to wait for a lot of things to get going inside Android Studio before the emulation would run. I mean, lots. In fact I thought the thing had crashed. So after a minute or so I pushed the RUN button again (it was alive and green, no indication that it should not / could not be pushed)... And I got this scary message:


I imagine that what had happened was that the emulator was still loading up its first instance, and there was no memory for two instances of the emulator. That is my guess. But it was unclear from the above message, so it is only a guess.

Finally I got to the stage of seeing my app in the emulator:



It takes time to gain confidence in a new development environment, but I am not impressed so far. It is very very slow, messages are ambiguous, greying out is not used (or is not used consistently) to indicate which buttons are validly actiove or not.

Still, I admit that a bit more experience may change my mind...

The next post is again about the emulator.

No comments:

Post a Comment