问题
I create a new hardware profile in an attempt to make and emulator for the Galaxy S8/S8+. I set the screen size to 5.8/6.2 inches (depending on whether S8 or S8+, despite the fact this doesn't appear to affect emulator anyway), and the screen resolution to 1440 x 2960, like the device. The emulator appears nothing like it does on the real device. Testing my app on a real S8+ shows it to be laid out poorly, but on the emulator it appear to be relatively organised, and I noticed it uses the dimens for my Nexus 6 emulator (xxxhdpi). Now the dimens values used isn't a big deal, because I'm happy to phase out the Nexus 6 considering it's no longer in production.
So I add some code to my launcher Java class that that gets me the dimensions of the emulator, here is what I get from my S8 emulator: {density=3.5, width=1440, height=2792, scaledDensity=3.5, xdpi=560.0, ydpi=560.0}
Besides the fact the height says 2792 instead of 2960 (I assume this is meant to happen), I believe I see the issue - the density is 3.5. As suspected, this is the same density as the Nexus 6. So the emulator I'm creating is not for the Galaxy S8, and this is evident in my comparison to a real S8+ which displayed my app in a distorted manner. As far as I'm aware, the Galaxy S8 has a density of 4, not 3.5. The IDE says the device has 560dpi. Now I need to be able to create an emulator with a density of 4, and the same specs I've already put down. How can I do this? How can I test for the Galaxy S8 without using the real thing? There isn't a preconfigured emulator for this device provided by the IDE.
Many thanks in advance.
回答1:
There is no preconfigured emulator. As per my experience, even if you try to create with matching device configuration it won't be much of use as it will still run stock android.
So, I found that Samsung provides online test lab like firebase.
You can go to http://developer.samsung.com/rtlLanding.do and check it out. They give 5 minutes free if you don't have developer account.
As per Samsung, you can get the following:
- 20 credits are provided to each Samsung Developer user every day.
- With 1 credit, users can use the Remote Test Lab service for 15 minutes.
- Minimum reservation: 30 minutes (2 credits)
- Maximum reservation: 10 hours a day (40 credits)
More details : http://developer.samsung.com/remotetestlab/rtlAboutRTL.action
来源:https://stackoverflow.com/questions/45306935/creating-an-emulator-for-galaxy-s8-android-studio