Test on emulator or actual device? [duplicate] - android

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Android Emulator vs Real Device
Is it better to test your app on an emulator or on an actual Android device? As in to test your app while you are still developing it.
In addition, does testing on the emulator gives you more computing power than actual devices?

It is always better to test on a real device, as the emulator lacks certain inputs like sensors etc. (especially the older version of it). You will also have problem testing services like In app billing and LVM as the emulator doesn't come with Google Play, and the accounts that can be configured on it are limited.
The best solution is to have a few devices to test on, and use the emulator for testing different screen sizes and how they react to your layouts. There was a Google I/O talk this year that gave you a breakdown of what devices you needed to test on to make sure you have maximum compatibility. I don't remember which one though, sorry.

Concerning the development period,you should test the application on emulator first so that you can test it on multiple targets having different versions eg:2.2, 2.3, 4.0 to find out the loopholes and the resolution issues.
After completion of development you can test it on your actual device for hands on experience.

I would say it certainly depends on your needs. Since you are developing an application that will be consumed not by yourself actually, it will be consumed by your targeted audience and what will they have? They will definitely have real devices to use your application.
There are some features that are not available or really hard to configure on the emulator, like for example you are developing an app that uses a bluetooth feature.
The emulator is certainly designed for developers to test their apps in a virtual environment with limited functionality.

It really depends on the kind of app you are creating. If you are creating a game that requires the accelerometer then a real device would be beneficial. Yet if you are creating an app with a simple layout and you want to test for different screen dimensions and so on, the emulator is pretty good with this.
Yet you should always have a real device, since the emulator is very limiting.

Android simulator provides a platform very similar to the actual phone, so if your application is running in the simulator, it goes to 94% given the same result in the actual phone, except that sometimes there are modules that must be compulsorily test on a phone like the GMap, Push, screen size..

Related

Difference between running a program in Android emulator and physical device?

I'm starting the studies about android development with Android Studio and I was wondering if it's possible to build applications only running code on a physical device or do I need to emulate others devices in order to avoid errors, etc.?
The Android Studio emulator barely runs in my machine, so I need to know if it is essential for the apps development or if there are other alternatives.
If you need to run on different versions of Android, just what #CrazySports101 mentioned, but also test different screen sizes & resolutions to check UI responsiveness, it would be better to use emulators.
Obviously, you can start development using either a single emulator or physical device, but during your final testing stages, it would make sense to use emulators to test all your device specific usecases.
And yes, there are few limitations with using an emulator, like it cannot emulate network connectivity, other real-time data, such as GPS, sensors, battery issues, etc. Or usecases such as calling, receiving SMS is not possible as well.
If you have a physical device, you can just use that. No need to run the emulator at all. An emulator is mostly used because it is convenient and easy to test different versions of android. For example, some libraries/UI component may behave differently on different phones.
It is better to use a physical device if your app is using radios like Bluetooth etc.
If you just started to learn android studio and your device can barely run emulator, I would recommend you to go for physical device. Emulator makes you possible to try your product on different version of android and screen ratios, but you can not emulate network connectivity, real-time data, GPS, sensors, battery issues, calling, receiving SMS is not possible. But if you are trying to launch a product in a market you should go for emulator as you would need to try your product on different versions as well.

How can I test my app for a specific device?

I am building an application with React Native but the app not working well on a few android devices. So I need to see what's going wrong but I don't know how to set up an emulator for a specific device. Are these problems depends on phone's brand and model or it just depends on their android versions?
Its not really possible. There's two major problems:
Software. Real devices don't ship pure AOSP like runs on the emulator. They add patches and features and there's no way to know what they actually run.
Custom UIs. Many phones provide custom UIs like TouchWhiz and the like which can override Android behavior
Hardware. If your app depends on things that are very hardware specific, like GPS or Camera, they could have issues due to hardware bugs.
If you just want to emulate a specific OS version like KitKat, or specific low memory conditions its possible via emulator configuration. If you really need to test on a device, either buy one or use a service that allows you remote control over specific devices. Amazon has a nice device farm that you can rent over AWS.
One of the biggest challenges when developing for Android is the wide variety of devices and "optimizations" manufacturers make to their Android versions.
The Android emulator is based on AOSP (vanilla Android) and was only recently published with Google services included. This is the most clean version of Android. You can use the emulator to test UI scaling for different screen sizes but it will always behave like an AOSP Android. Google packs a bunch of hardware configurations into Android Studio which you can simply select when creating an virtual device. You can always create a custom hardware profile with custom screen size and resolution. Some manufacturers also change the DPI value of the OS causing the UI to be bigger or smaller, keep this in mind when creating a custom hardware configuration.
Further, you can use the emulator to test the default behaviour on different Android versions. Again, manufacturers change their Android usually causing slightly different behaviour.
I assume that your question is focussed on different behaviour of e.g. Samsung phones having crashes only occuring in Samsung phones (Samsung can be exchanged with any other brand here). Unfortunately, there is no simple way to test this but getting your hands on the faulty device. One option is to use a cloud based test lab (e.g. Firebase Test Lab, App Center or AWS device farm) to test your code on the faulty device or rent the device at a local shop. Most bigger cities have companies renting phones and tablets on a daily or weekly basis.
In the end you will need if statements checking for a specific device, manufacturer or Android version or any combination of them and doing something slightly different to fix the undesired behaviour.
I know that this is not the answer you are looking for, but it's the best I can offer. To tell a little tale of my worst experience: I had once a bug were calling a crypto function caused a kernel panic on HTC (?) phones. This means the user opened my app and the phone rebooted. I was required to implement the entire encryption logic again just for HTC with Android 6.0.

Where can I run into pitfalls when using an Android emulator over a real device for app development?

I want to get into developing apps for Android because of its large userbase. However, at the moment I do not have a smartphone. I'm also not too keen on getting an Android phone in the future.
What problems could I encounter when developing apps for Android solely using an emulator? I could use my parents' Android phones for the occasional testing, but will an emulator prove sufficient otherwise? Furthermore, is it possible to set up an Android Virtual Device with low-end hardware on my computer to test out apps with low-end phones?
note0: I do not plan on developing apps which require use of the phone's sensors (such as gyros, GPS, etc.) I only plan on developing apps which require internet access for API calls and perhaps microphone usage (I can't give away too many details right now ;) )
note1: I know this question has been asked before on stackoverflow (albeit 4 years ago). However, I feel it is important to revisit the question because emulators, hardware, and Android itself have changed enormously in the last few years.
edit: My main issues are problems like the app looking weird on the phone despite it looking fine on the emulator or working slowly on the phone but working fine on the emulator. Will every app which works fine on the emulator work fine on the phone as well with a similar hardware configuration as the emulator? I'm in particular targetting devices with Android 4.x/5.x.
Without a doubt, the biggest problem is that many functions like push
notifications, maps, geo-location, in-app vending etc. cannot be
tested with an emulator. The reason is that all these functions are
present in the Google Play Services library which is not present on
emulators.
Another important reason for testing on hardware devices is that the
OS implementation is changed by manufacturers like Samsung, HTC and
others, and therefore, certain problems & exceptions are not observed
till a real device is used.
But the most important reason has to be that running apps on an
actual phone is a hell of a lot more fun that it is with the painfully
slow and retarded emulators! One of the most important things about
Android is that anybody with an Android phone can easily explore
computer science concepts by running simple programs on their phone.
It is incredibly easy, even for a novice, to just fire up their
Android device and start exploring the world of programming! Till just a few years back, it was incredibly difficult to debug an app on a Symbian or Palm or WinCE device. iOS is still as retarded when it comes to running the simplest apps, you have to create a provisioning profile to run a Hello World app on an iPhone!
EDIT:
If your processor supports Intel virtualization, then the emulator can be made to run as fast as a real device. You need to check that out. If your PC is low-end in the sense that it does not support such virtualization, then running and testing Android apps will be a painful, tedious experience that will suck all the fun out of the development process.
Emulators do have one significant advantage over real devices - an emulator is able to access web services on a localhost. If you are still in development phase on your local server and have not yet shifted to a publicly hosted environment, the emulator can easily access web services on a local server. All you have to do is put your computer on the same network as the local server and you're good to go. A real device cannot access a localhost; its impossible, as far as I know.
The Android emulator is a true emulator - it emulates sensors as well, so in fact you can test sensor programming (with some limitations) on an emulator. It cannot do things like GPS, maps etc. because those features have been migrated to the Google Play Services library, and they require a valid Google account to be used, which is why that library is not present on an emulator. If you only plan to work with web services, APIs', GUIs' then I suppose an emulator is more than sufficient. Unlike the iOS simulator, an Android emulator generally exhibits the WYSIWYG behavior, so your GUI will not differ on actual devices, although you do need to test your GUI on multiple AVDs' with different screen form factors.

Developing an Android phone app -- can I use an Android tablet to test it on?

I've developed a couple of Enterprise iOS apps for our users in the field. Some have expressed a preference for Android devices over Apple, and I fully understand. I do not have an Android phone, nor do I want to get one and have a second account to maintain. I'm wondering if I can use an inexpensive Android tablet to reliably test an application that will ultimately be running on an Android phone? The app will need to communicate via internet to a server via cell connection or wifi.
Also, any advice for an Android newbie developer would be appreciated.
Yes you could test on a Android tablet but it would be hard to see how it render on a phone.
You could also use the Android Emulator to test different size and android configuration.
Yes. I developed my first major Android app using only a couple of cheap tablet devices. It's fine; the only thing you can't really test is "what happens to my app when a phone call comes in." Plus if you can get the emulator working under HAXM, or some other similar setup where it doesn't work like a tortoise trapped in amber, you can test on a variety of simulated devices perfectly well.
Other things to consider:
You'll probably want to test your app on a variety of different hardware and Android versions, in particular I'd recommend testing on older devices. This means that you friends' old Android phones are a great source of cheap test devices. I regularly gather phones from friends that would otherwise just end up lingering in the back of a drawer as a "spare" that will never actually get used. Bear in mind that you can use all the features of a phone apart from the actual phone bit without a SIM, including a WiFi-based data connection.
You may find that you can find good, contract-free "pay as you go" phone SIMs. I use a provider whose "credits" don't expire, so I have a phone connection for my test devices where there's no ongoing cost, apart from the actual calls I make when testing.

Is it worth purchasing Google Android Dev phone? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I've been intrigued by all the android world since I first learned about it and would like to get my hands dirty developing for it. The question that comes to mind is if it's worth buying the unlocked phones that Android sells directly or not.
Those phones (link) quoting the Android page:
Run and debug your Android™
applications directly on a device.
Modify and rebuild the Android
operating system, and flash it onto a
phone. The Android Dev Phone 1 is
carrier independent, and available for
purchase by any developer registered
with Android Market™.
Please note that this device is
intended for development purposes, and
may not include certain features found
on consumer Android devices.
So will it be worth it to purchase one of those as a tool for app testing as opposed to developing and testing just on Eclipse or one of the other IDEs and emulators.
-Have you tried it, do you own one?
I'm assuming they have the same specs as the HTC Dream and the HTC Magic, since they look exactly the same although they have a 'developers edition' custom black design not that I really care about the design for this particular item.
All comments are welcomed,
Thanks in advance.
Update:
I'll leave it open until tomorrow to see if there are any more answers, then I'll just pick the most voted since it's really a subjective question with no good or bad answer.
It depends what sort of applications you wish to develop. I find that the emulators very accurately reflect how things work on genuine devices; you can seamlessly connect to either an emulator or a dev phone using the command line tools, the Eclipse tools, the debugger etc.
Also, while you can flash your dev phone to a new OS version, HTC often lag behind (e.g. there's still no 2.0 image available) and it's much easier and faster to just use the emulators. The emulators also allow you to create and test with different screen resolutions, whereas the two dev phones available are only "standard" resolution.
I find it's quite rare that I need to use my ADP1 dev phone for development -- my rooted consumer HTC Hero works fine for most of the development I do.. allowing me to pull files from the device etc. Though the only reason I use my Hero rather than an emulator is because I've been working on an app that uses audio recording functionality.
However, where having a physical device would help is where you need to do specific stuff regarding the camera, audio hardware, orientation and compass sensors, GPS, wireless network access and so on. Should you need to connect a debugger to work on hardware-related issues like the above, then you would definitely need a dev phone.
Overall, it's definitely worth buying an Android phone for testing and demonstration purposes, but whether it's a development phone is up to your requirements.
If you plan on developing apps that you intend to put on the Android marketplace, it's absolutely critical to test on real hardware. You can get away with developing on the emulator for quite a while, but at some point, you'll want to use a real device.
That being said, you can use any android phone for development. There are some restrictions on locked devices, but if you're simply developing against the SDK, any phone will work. With android, you can install an apk directly on the phone without special permissions, so the only real advantage to a dev phone is that you can install new roms without having to root the phone.
Personally, I'd hold off on purchasing one of the older dev phones. From what I understand, they only support up to SDK 1.6, whereas the Droid and some of the other new phones are supporting SDK 2.0 ++.
Wait for the release of the Nexus One from G. The latest rumors are that it'll be released on Jan 5th. So it's just a week or so.
I think that you need a real android device whether it's the dev phone or another handset but a real phone is primordial. The emulator is great but you can't get an idea about the execution speed of your app until you use it on a real phone.
As said before there are a lot of rumors about the nexus one so wait and see!
As for which phone to buy (assuming you're going to get one) I think ablerman is right. I'd wait until January to see if there is going to be some new hardware available.
With regards to the more general question of should you buy one, I think it depends on what you're doing. For the most part, the emulators are fine. They can emulate GPS (you can even load KML to simulate a path), SMS, phone calls, etc. They cannot however emulate acclerometer/compass/orientation sensor data and actually will crash (actually I believe it hangs...) if you try to run code that relies on it. Also, it's difficult to actually debug phone-call related functionality without the dev phone.
They're good phones, I've used the Dev phone 1 (the G1/Dream) and it's nice. It also is a bit faster than the emulators and if you're writing something like a game, it would be really good to test it on the actual hardware.
All in all, it just depends on what you're writing. They're definitely fun to play with regardless as you can do pretty much ANYTHING you want on them.
Good luck with the decision!
I've been developing with the emulator since June. I've found it to be a very near substitute for the real deal, and it's easier to switch between handset configurations/versions. However, not knowing how quickly my apps will run is a concern for me.
The reason I've personally held off buying a handset is that 2009 was the wrong year to buy one. I have a feeling 2010 will very much be the long-awaited "Year of the Android".
+1 to Christopher and I will add - the emulators are great but having a physical phone will give you instant access to the Android Market to verify publishing, statistics and user comments. I also believe using your own app on a physical phone will help you to develop a better app. You do not need a development phone - but at least one physical phone - absolutly.
FYI. Belgium is one of the few countries where it is possible to buy any mobile unlocked. Indeed, the Belgian regulators forbid the forced bundling.
One more Pros for buying a real developer phone :
HierarchyViewer does not work on user builds (i.e. with devices
available in stores.) This is for security reasons.
See the original thread
Hierarchy viewer can be very useful if you have problems with layout being slow, although I don't think it would worth buying a real Developer phone only for this.
As some people made workaround for that problem : https://stackoverflow.com/a/7801475/62921.

Categories

Resources