Reputation: 7521
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:
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
Reputation: 449
I saw a comment saying to edit config.ini and that fix for me.
that did that trick for me.
Upvotes: 1
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
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
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.
The next step after filling the form above is activating your account.
Clicking the link sent to you via email should send you to the screen below.
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.
Next you'll see a log in page.
Next is the download page choose a version based on your platform.
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).
Move Genymotion to the Applications folder.
Launch the Genymotion desktop application.
You should be prompted to sign in again.
In the next screen you are prompted to choose a license; go with Personal Use.
Then agree to the terms and conditions.
Once logged in you'll see a list of devices from which you can select or you can build your own custom device.
Scroll to the bottom to find the add custom device button.
On clicking the above button you are presented with a dialog to configure your custom device.
Once done click the confirm button and watch the progress in Genymotion.
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.
Genymotion should start booting your device.
And voila your device is up and running.
Here is the launcher app in your new device.
Over in Android Studio your device should be listed in the connected devices dropdown menu in the Logcat.
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
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