Small font size in Android emulator - android

Sometimes I notice the Android emulator starts with a very small font size. This seems to happen randomly. Other times it has a normal font size.
I use ADT 10.0.1.
Do you know what is the problem?

This happens very often, and although I'm not sure about the exact reason behind this, it seems that somehow the wrong density was detected for this and resources for a lower dpi is loaded inside a higher dpi emulator. That's why everything is smaller, but the layout works properly and aligns things at their own places. And you're right: when this happens, network doesn't work in emulator! These two things seem unrelated, but my guess is that emulator fails at loading config for the current virtual machine successfully, and that includes density and network capabilities.
Anyways, there doesn't seem to be any official info on this, and similar reports in android-developers mailing list didn't get any response for developers of Android, although this is a very popular bug.
And the solution right now is only restarting the emulator. Sometimes you have to do this more than once, but finally it works.

Make sure your computer's display resolution can satisfy your emulator's exact resolution. If you are using Mac with Retina Display, this problem may occur. Try changing display resolution via Display settings.

Related

4k display & Android emulator: fail

I'm moving to my new laptop which has 4k screen (3840x2160, to be exact). As my OS of choice I have Linux, and all scaling I have set up for this is done via Gnome (scaling-factor in gnome tweaks is set to 2). Overall, setup looks perfect, except for Android AVD run in IntelliJ IDEA.
AVD is configured to use skin with 1920x1080 dimensions, and I've expected that it would be roughly the height of the screen, however for some reason AVD is scaled up, which obviously looks.. weird and unusable.
I've took a look at relevant questions here about scaling the emulator, but it seems that IntelliJ interface has changed, as there is no Emulator tab in Edit Configurations menu (and answers to questions I've seen said to use that option to downscale the emulator). So, question is: how do I scale it down (or, to put more correctly, how do I disable the scaling for emulator)?
Ok, I've found out what the issue was. UI scaling is handled by Qt in case of android emulator. It was set to: QT_DEVICE_PIXEL_RATIO=2 somewhere in my configs. This made emulator act weird. Cheers!
Just delete the environment variable and restart Android Studio to get the new env variables.

How to test android application?

Developed a application of size 40MB. I need to test it for all screen support but the android emulator really a bad choice(I feel... ). It gives Insufficient memory error almost every time). How developer test their application?
One more Question
I have designed app for four different layout(normal,small,large and xlarge). Will every device(In future) satisfy these layout params?
And i faced a real problem that i tested my app in Sony xperia minpro(Small screen 240*320 2.4inch) and in Samsung galaxy 5(smallscreen 240*320, 2.8inch) but the layout is overlapping in samsung device. This can be a serious problem , actually we cant check our app in every device.. that is impossible too.
TIA
40MB is way too big for an Android application. Many users will have problems installing the app on their devices. You should consider moving some resources out of the application and downloading them either on demand or on first app run.
The list of layout types (normal, small, large, xlarge) is definitely not final, for there quite possibly will be even larger screens (xxlarge) or tiny ones (xsmall?).
Developed a application of size 40MB. I need to test it for all screen
support but the android emulator really a bad choice(I feel... ). It
gives Insufficient memory error almost every time). How developer test
their application?
You can configure the emulator with any amount of memory you wish, including an emulated SD card so memory shouldn't be a problem. However, 40MB is quite big so you may be hitting the package size limit.
One more Question I have designed app for four different
layout(normal,small,large and xlarge). Will every device(In future)
satisfy these layout params?
You're asking us to predict the future - there's no way we can know what Google are planning if they haven't already announced it though I would suggest that there will never be a commitment to keep screen sizes or resolutions static - technology constantly evolves and specs that are OK for today, will not be OK for tomorrow.
I have seen dictionaries weighing in at 40Mb, best practise is to download the database as a separate file. Some graphically intensive games approach that size. If you want to emulate many Android devices make sure your PC is up to snuff and you have the latest SDK.
How developer test their application?
You do not have so many choices: you have to use as many (and different) physical devices as you can, from different vendors and technical specifications (screen, etc), to try to detect as many specific bugs as possible.
This is difficult, as you are often limiten to a few physical devices.
To give you examples, I recently struggled with the Camera, for a bug happening with Motorola Defy only. I am currently struggling with the Camera, but only for Samsung Galaxy this time.
When you find a specific bug, try to fix it "the general way": instead of detecting the vendor/version of the device to write specific code for it, try to enhance your code in a way it will work for all tested phones. So far, I never had to write anything specific to a given device. The bugs I encountered were always tied to a permissivities or particular cases that could be handled by making the common code more complete or resiliant. Let's say by "making as less assumptions as possible" knowing that we tend to make assumptions without meaning it.
On top of testing on as many physical devices as possible, create emulators. You can parameter them to have different screen layouts, different embedded hardware, memory, etc. And on top of the default emulator that comes with the Android distribution, you also have emulators provided by the devices vendors and that reproduce the specificity of these devices. For example, Samsung released a Galaxy Tab emulator. Sony Ericsson released a EDK Cellphone emulator. You can get them thru the regular android distribution update workflow.
Will every device(In future) satisfy these layout params (normal,small,large and xlarge)?
Yes, as Android distributions are backward compatible. Any of these layout will still be supported in the future, but may become 'deprecated' (so not recommended, but still working), and new layout types will certainly be created.

Best way to test Android layout before submitting to market

reading about all these different resolutions and hardwares for Android I am a little unsure if the layout I created for an Samsung Galaxy will actually work the same way on all (most) Android devices.
I did not use anything fancy or complicated. However I had to use fixed width in several places to align text and buttons nicely. ALso there is some text with linebreaks that could look differntly if on narrower screens
How can I be sure that my layout will work on other devices? Or is this actually a no issue? Testing in the debugger is sooooo slow, that I actually never got it to work properly.
Thanks very much!
You can set up multiple emulators with different screen sizes, that simulate the possible targets.
In the emulator Ctrl-F11/12 (thanks #ccheneson) allows you to change the orientation, so that you can test that as well.
The emulator may be slow, but to see how the layouts look like it should be fast enough - you may still test the logic on a real device.
Also emulator speed seems to be highly dependent on the screen size.

Android views' borders issue on some devices

TOPIC Solved: Answer below.
Some users have been reporting border alignment issues on some android components such as the alert popup or the editTexts. This is happening on the Samsung Galaxy Apollo (200x400) and the HTC Pro Touch (480x640) devices. I cannot replicate that because i don't own those devices and in the Samsung Galaxy S and emulator everything looks just right.
I think that the problem is the dpi or resolution of the device (because the edittext background is a single .9.png so image should look ok); however I am not sure if the supports-screens tag is the solution. Also, application was developed using Api 3 (v1.5) and supports-screens was not yet supported, nor the screen-size resource qualifier.
The style used for the alerts and editText is the phone default. Could the problem be something related with the theme applied to the phone by the user?
Thanks in advance!, I show some images given to me showing the problem:
It might actually be the display density causing this. If you don't provide assets in the appropriate density, the framework will try to rescale your images, including 9patches. Unfortunately there's no real perfect way of resizing 9patches and it can sometimes lead to artifacts, although I would be very surprised if it caused the type of artifact you are seeing.
I've had the same problem and the solution was changing the font size of the TextView from 16px to 17px (or any other odd number).
Well it really was the resolution/density. I managed to create an emulator with the WQVGA density (which needed > Android 1.6) and replicate the error.
The solution is seen on the Supporting Legacy Applications section of the Android Developers webpage: http://developer.android.com/guide/practices/screens_support.html. So a newer version of the API is needed in the project but it still holds support for the 1.5 version.
Thanks.

Android Eclipse emulator problem: Runs WVGA(hdpi) as a mdpi screen

The problem I am having is that when I run a FWVGA or WVGA sized emulator it sometimes runs at a MDPI size instead of HDPI. Here is an example with pictures
http://wonton-games.blogspot.com/2010/06/emulator-problems.html
I create the AVD with the proper hw.lcd.density setting and screen size and it randomly does this. There doesn't seem to be a pattern. I used to be able to just delete the AVD and create it over again and it would fix itself for a while but now it's getting worse.
Does anyone have any ideas cause I posted on the Android Developer forum but all I got was other people saying they get the same problem.
I get the same problem and find that it is often only solved by a reboot - of my PC rather than of the emulator. I've not needed to edit or recreate the AVD to solve the problem.
I think it might be related to unplugging my laptop from an external monitor and so changes the Windows display resolution but I haven't been able to regularly recreate the problem.
Since the same AVD image can work one day and not the next and the start working again after a reboot means that this must be a bug in the emulator rather than a problem with the configuration of the AVD.
Unfortunately, I don't know of any workarounds for the problem and as far as I can tell this hasn't been logged as a bug. (I haven't logged it myself since, as you say, it occurs randomly which makes it hard to fill in a decent bug report.)

Categories

Resources