Makalele
Makalele

Reputation: 7521

Android emulator - simulate particular device

I'm trying to simulate LG K4 2017:

https://www.gsmarena.com/lg_k4_(2017)-8489.php

Size 5.0 inches, 69.6 cm2 (~66.3% screen-to-body ratio)

Resolution 480 x 854 pixels, 16:9 ratio (~195 ppi density)

I'm trying to do that in AVD manager, I set the same screen size and resolution, however app looks very different (on the real device everything is much bigger, in other words I can see less content).

Here's how the settings look like:

enter image description here

I think screen size should be normal, but there's no way to change that - it's automatically changing according to screen size and resolution.

Is it possible to somehow change to simulate this device?

Upvotes: 6

Views: 6126

Answers (5)

Elano Vasconcelos
Elano Vasconcelos

Reputation: 449

I saw a comment saying to edit config.ini and that fix for me.

  • open AVG manager
  • right mouse click and select Show on Disk
  • open the file config.ini
  • change hw.lcd.density value to 240 (hw.lcd.density=240)
  • start the device emulator

that did that trick for me.

Upvotes: 1

Hamza Khan
Hamza Khan

Reputation: 1521

It happened with me when I tried to Simulate Samsung A8, but it was a display setting issue (Font size were larger on the Real device and smaller on emulator). You may check pixel density as well.

Upvotes: 0

Vanshaj Daga
Vanshaj Daga

Reputation: 2165

As you can see as soon as you select 5 inch it selects density as mdpi. Modify the attribute hw.lcd.density=195 at avd config file: /Users/yourUserName/.android/avd/YourDevice.avd/config.ini, and reboot your virtual device.

Upvotes: 1

mtotowamkwe
mtotowamkwe

Reputation: 3037

Android Studio tries to render high quality Android Virtual Devices (AVDs) out of the box.

If you have tried Android Studio and it still hasn't worked out I recommend using a third party e.g. Genymotion.

They offer a free tier; i.e. a license to use their Virtual Devices/AVDs (customized or from manufacturers) for free personal use.

Following are steps for setting up Genymotion.

Visit the Genymotion website specifically this link to create an account.

CreateAnAccount

The next step after filling the form above is activating your account.

AccountActivationMessage

Clicking the link sent to you via email should send you to the screen below.

AccountActivationSuccessful

Click the download genymotion for personal use button. This sends you to the page below look for the Download Genymotion Personal Edition button just above the robots head.

Download a free to use edition of Genymotion

Next you'll see a log in page.

Log into Genymotion

Next is the download page choose a version based on your platform.

Choose Genymotion version

Choose the download that comes packaged with VirtualBox as Genymotion requires VirtualBox to run in your local environment.

Once the download is complete install Genymotion on your machine.

I'm installing it on a mac (double click the dmg installation file).

GenyMotionInstallationFile

Move Genymotion to the Applications folder.

MoveGenyMotionToApplicationsFolder

Launch the Genymotion desktop application.

GenymotionDesktopApplicationOnmacOS

GenymotionFlashscreen

You should be prompted to sign in again.

SignIntoGenymotion

In the next screen you are prompted to choose a license; go with Personal Use.

Choosing a Genymotion license

Then agree to the terms and conditions.

GenymotionEULA

Once logged in you'll see a list of devices from which you can select or you can build your own custom device.

DeviceList

Scroll to the bottom to find the add custom device button.

AddCustomDeviceButton

On clicking the above button you are presented with a dialog to configure your custom device.

CustomizeGenymotionDevice

Once done click the confirm button and watch the progress in Genymotion.

DeviceGettingCreated

When Genymotion is done creating your device click on the device's three button menu to the far right. Here there is an option to start the device.

StartDeviceMenuOption

Genymotion should start booting your device.

BootingVirtualDevice

DeviceBooting

And voila your device is up and running.

UpAndRunning

Here is the launcher app in your new device.

AppLauncher

Over in Android Studio your device should be listed in the connected devices dropdown menu in the Logcat.

enter image description here

I have no affiliation to Genymotion and won't receive anything from this recommendation. I just use their desktop application when doing testing for my Android projects.

Further information regarding Genymotion can be found here.

Hopefully this should get you closer to your goal.

Upvotes: 2

B. Plüster
B. Plüster

Reputation: 654

Perhaps the text on the screenshot is larger because the display size settings on the LG K4 were set to something larger than default. I've run into this error a few times, where an application would look completely different when viewed on different phones of the same size because of this setting.

As far as I know, it is not possible to simulate exact display sizes with the Android Emulator. Also, if it were possible, it would not guarantee looking the same as the actual phone as most manufacturers have custom settings and skins which cannot be replicated by the emulator.

Upvotes: 7

Related Questions