Android Things模拟器 [英] Android Things Emulator

查看:126
本文介绍了Android Things模拟器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有一种方法可以使用可从Android Things网站下载的系统映像在Android Studio中设置模拟器. 我已经有了Raspberry Pi 3,但是我总是必须将其插入电视,这根本不是很实用.那就是我问的原因.

I was wondering if there is a way to set up an emulator in Android Studio using the system image that can be downloaded from the Android Things website. I already have a Raspberry Pi 3, but I always have to plug it into the tv which is not very practical at all. That's why I'm asking.

推荐答案

您无需将Raspberry Pi插入电视即可使其适用于Android Things.在未连接HDMI电缆的情况下,Pi仍然可以工作.

You don't need to plug the Raspberry Pi into a TV for it to work for Android Things. The Pi will still work without a HDMI cable connected.

如果您确实想创建UI,则可以使用普通仿真器,然后在AndroidManifest.xml中添加不需要Android Things SDK的信息:

If you do want to create a UI you can use a normal emulator and in your AndroidManifest.xml add that the Android Things SDK is not required:

 <application ... >

      <uses-library android:name="com.google.android.things" android:required="false"/>

      ... activities etc

 </application>

android:required ="false" 是关键

您只需要确保仿真器上运行的代码当时未使用任何Android Things Java导入即可.

You just have to make sure, that the code that is running on the emulator is not using any of the Android Things java imports at that time.

确保Android Things SDK代码与核心应用程序保持独立的一种方法(这意味着您可以在模拟器上运行核心应用程序)是使用 Hexagonal Architecture (六边形体系结构)分离代码.对于您的问题来说,主题很少,但可以避免使用树莓派模拟器",您可以在此处阅读有关此内容的更多信息:

One way of making sure the Android Things SDK code is kept separate from your core application (meaning you can run your core app on an Emulator) is to separate the code with Hexagonal Architecture, it's a little off topic for your question but it would allow you to avoid the need to have a "raspberry pi emulator" you can read more about this here: https://www.novoda.com/blog/testing-android-things/

这篇关于Android Things模拟器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆