Android Emulator Woes

Written by sipping | Published 2023/05/04
Tech Story Tags: mobile-app-development | mobiledebugging | emulator | android-app-development | flutter | android | android-studio | app-development | web-monetization

TLDRMobile emulators are beneficial for native app developers. This article talks about in person issues and problems faced by using emulators during mobile development.via the TL;DR App

What are mobile emulators?

“What is a Mobile Emulator? A mobile emulator, as the term suggests, emulates the device software and hardware on a desktop PC, or as part of a cloud testing platform. It is a complete re-implementation of the mobile software written in a machine-level assembly language. The Android (SDK) emulator is one such example.” (source)

In simpler terms: A mobile emulator lets you design and test your app on virtual devices which are almost exactly like their physical counterparts.

Mobile emulators are beneficial for native app developers. This is because they can test their Android or IOS apps on different versions of that operating system and phone models. They are even better for mobile developers who use Flutter because they can make apps and test them on both Android and IOS versions and device types.

Mobile emulators are really the saving grace of mobile development, without which, very little progress would have been done in this tech sector. A great example of what happens when a developer doesn’t have an emulator to use can be seen with my situation.

Emulators and Android Studio

Android Studio is a software, designed by Google, both for mac and windows that allows you to build mobile applications. The mobile applications can be native for Android but can be for Android and IOS if you use Android Studio and Flutter.

In other app-making software, you need to download emulators separately and configure them separately when testing your application. Then you need additional libraries and plugins to connect them to each other to run concurrently.

In Android Studio it is different. You are given an already-made list of Android devices that you can download and import into your project. Once imported in you can start up the virtual phone and load your application and begin testing. What happens if the emulators stop working? Is such a thing even possible? The answer to those questions, as I soon discovered, is “Trouble” and “Yes”.

My Emulator Woes and Triumph

I had previously downloaded and used Android emulators for different projects over the years. Currently, for the app I am designing, I have more than one emulator ready to use.

This is shown below:

Above one can see I had the Pixel 4, Pixel 5, and Pixel 6 phone models with Android 10.0 on for most of them and Android 8.0 for one. The reason for the discrepancy between Android versions is that when testing you have to test newer operating systems as well as older ones.

The problem with all three of these options was every time I kept trying to run the emulators and then subsequently run the app, Android Studio would return:

I tried, for hours, to figure out what was happening but to no avail. There was something that made it all the worse. Each time I tried to run the same emulator or a different one, it took 45+ minutes for a response to come back. It also displayed different error messages each time. The one above was just the most common, there were 4+ different ones.

I had spent more than a week on this issue. Without resolving this issue, and without being able to use my emulators, there was no way I could continue development. How can one continue when we can’t even see the output of our own code? bad situation.

After looking through my emulator list and deciding if I should delete and re-download my emulators for the 5th time. I noticed something.

I could add a “general” Flutter emulator to my emulator list:

I did not know Flutter gave that option. I could even choose the API level and Android operating system version. Upon my attempts to run the emulator, it took 35 minutes or more to get started but eventually, it presented itself and I could run the app:

After running the Flutter emulator, one can see everything now works! I DO NOT KNOW why Android Studio allows this emulator to work but not the others. Though we must ask, does it even matter? All I know is the emulator now consistently works and is able to run the apps I need to test. I can even change the Android versions and API levels. So does it even matter if the rest don’t work? Not at all it doesn’t. The original issue may not be known or solved BUT it does not matter as work can now be continued.

Lesson:

One might say “This isn’t a good solution. You still don’t know the original problem” or “What if the Flutter emulator stops working?” and to those I have one thing to say.

This problem taught me a crucial lesson, that is: Do not get hung up on the problems or small inconsistencies. Are you able to continue the work at the same speed and quality? IF the answer is yes, then continue what you are doing and ignore the things that seem major but are actually quite minor.

“What if the Flutter emulator stops working?”. IF the emulator stops working we will solve that problem at that time. However, considering that the others still don’t work and it works it means that they are affected by a different sub-system or dependency issue.

Until an issue arises, THIS developer will still be using that Flutter emulator happily and gleefully. : )

Let me know what you think in the comments!


Written by sipping | Young African filled with Africanacity, hope and a steady passion for long lasting change.
Published by HackerNoon on 2023/05/04