简体   繁体   English

在 Android 模拟器和物理设备中运行程序之间的区别?

[英]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.?我正在开始使用 Android Studio 进行有关 android 开发的研究,我想知道是否可以构建仅在物理设备上运行代码的应用程序,或者我是否需要模拟其他设备以避免错误等?

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. Android Studio 模拟器几乎没有在我的机器上运行,所以我需要知道它对于应用程序开发是否必不可少,或者是否有其他替代方案。

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.如果您需要在不同版本的 Android 上运行,正如@CrazySports101 所提到的,还要测试不同的屏幕尺寸和分辨率以检查 UI 响应能力,最好使用模拟器。

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.是的,使用模拟器几乎没有限制,比如它不能模拟网络连接、其他实时数据,如 GPS、传感器、电池问题等。或者也不可能使用诸如呼叫、接收短信等用例。

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.主要使用模拟器,因为它方便且容易测试不同版本的 android。 For example, some libraries/UI component may behave differently on different phones.例如,某些库/UI 组件在不同手机上的行为可能不同。

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.如果您刚开始学习 android studio 并且您的设备几乎无法运行模拟器,我建议您选择物理设备。 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.模拟器使您可以在不同版本的 android 和屏幕比例上试用您的产品,但您无法模拟网络连接、实时数据、GPS、传感器、电池问题、呼叫、接收短信是不可能的。 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.但是,如果您尝试在市场上推出产品,您应该选择模拟器,因为您还需要在不同版本上试用您的产品。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Flutter 应用程序在 Android 模拟器上运行,但不在物理设备上(OnePlus 7T) - Flutter app is running on Android Emulator but not on Physical Device (OnePlus 7T) 为什么Android在物理设备和模拟器上显示dp值有差异 - Why is there a discrepancy between Android display dp values on physical device and emulator Firebase Auth 给出 ViewPostIme 指针 1 在物理设备上运行但在 Android 模拟器上工作(Firebase 仅在模拟器上工作) - Firebase Auth gives ViewPostIme pointer 1 While running on a physical device but work on Android Emulator ( Firebase works only on emulator ) 将 android 仿真器连接为物理 android 设备 - connecting android emulator as a physical android device 仅在物理设备而非模拟器上运行 Android 应用 - Run Android app Only on Physical Device not Emulator 尝试用物理设备替换模拟器(Android Studio) - Tried to replace an emulator with a physical device (Android Studio) 通知显示在 android 仿真器中,但不在物理设备上 - Notification shows up in android emulator but not on physical device 在Android模拟器中调试物理USB设备 - Debugging physical USB Device in Android Emulator ImageButton在模拟器或物理设备上的Android Studio上不可见 - ImageButton not visible on Android Studio on Emulator or physical device 将 Wear OS 模拟器与物理 android 设备连接 - Connecting Wear OS emulator with a physical android device
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM