# ADB连接及投屏

| <p>X2眼镜默认关闭ADB install 权限，故安装apk前，请执行以下指令开启安装权限： </p><p>adb shell settings put global mercury\_install\_allowed 1 </p><p></p><p>X3pro 增加了ADB开关，请查看： <a href="/pages/aRcfXd2nP20Ra5PNHMSf">ADB指令 </a></p><p>若开启后还是无法连接，请查看： <a href="/pages/EFDPZxczuD3gTdQRVzU6">X3Pro adb无法识别解决方法</a></p> |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |

开发者在真实设备上测试和调试应用程序之前应如何设置雷鸟眼镜

通过Rayneo数据线连接眼镜设备后，您可以使用ADB 对 Android 应用程序执行高级测试和调试，阅读运行日志，以及查看Profiler等相关性能属性。

## **通过USB连接雷鸟眼镜-unity**

1.通过Rayneo数据线将设备连接到计算机。

2.要验证连接，请打开Unity项目，然后在菜单栏上点击File>Build Settings。

3.在Platform列表中，选择Android，然后单击Switch Paltform。如果平台已设置为Android，请跳至下一步。

![](/files/4e3efd007a54298ef8d355c6dcf41eb315717e62)

4.在Run Device列表中，选择对应的设备即可。如果您没有在列表中看到Android手机，请点击刷新。

![](/files/f40dbc6491edfb14a8b578b655f5ec9e7d07e61d)

5.单击Build And Run，以在Android手机上运行该应用程序。

6.如果您看到程序成功在Android上运行，请进行下一步操作。

## **使用投屏工具协助开发**

为了将眼镜内容投屏到pc端，便于开发，可下载 [anlink](https://cn.anlinksoft.com/)（仅限windows），或使用 [scrcpy](https://github.com/Genymobile/scrcpy)进行投屏

### **scrcpy投屏介绍**

Scrcpy可以通过adb将手机的屏幕投到电脑上,并可以通过鼠标控制Android设备.它可以通过USB连接也可以通过Wifi连接.以下是介绍使用USB连接的过程

#### **1.下载Scrcpy**

<table><thead><tr><th width="198">下载方式-github</th><th>https://github.com/Genymobile/scrcpy/releases/tag/v2.0</th></tr></thead><tbody><tr><td>下载方式-文件</td><td><p></p><div data-gb-custom-block data-tag="file" data-src="/files/tZE2vJmIEqrDmQxAmJj2"></div></td></tr></tbody></table>

#### **2.打开命令行**

解压并打开命令行(在文件夹空余位置按住shift并右键)

![](/files/5302cef485ed2a6265bd6e382fb6cb1479ac58bd)

#### **3.确认设备连接状态**

使用以下命令查看设备连接状态

```
.\adb.exe devices
```

![](/files/165aa3138be54ef14f8801b65971119f79753783)

#### **4.开始投屏**

执行以下命令投屏设备

```
.\scrcpy.exe --display 0
```

当看到以下画面时,投屏完成

![](/files/e2bd44d420a51884df963252b7a08e27de2afc25)

![](/files/ec70cec1b1ab2283112701eca9389fc440b1b5de)

此时,鼠标可以在上面执行滑动点击等操作

#### **5.其余问题**

如果发现眼镜中有显示,但是在scrcpy中是黑屏.则是因为选择了Single Pass,性能更好.但是如果确实需要显示,请更改成Multi-pass

![](/files/0853c0488b7f4324d6cb926a89b1ff98c447f839)

### **Scrcpy投屏--mac版本**

**在mac上使用scrcpy会比较麻烦，可参考如下两种方式：**

【参考一】<https://guozh.net/install-scrcpy-on-macos/>

【参考二】

1.<https://www.macports.org/install.php>

| <img src="/files/CV732Qxb47vreVT0pR1Z" alt="" data-size="original"> | <img src="/files/YpT05NmKhzJHD083JKhQ" alt="" data-size="original"> |
| ------------------------------------------------------------------- | ------------------------------------------------------------------- |

2.<https://ports.macports.org/port/scrcpy/>

| ![](/files/07964ad1b487eb4ac4451c8a5d5940c8ffa3bdce) | ![](/files/9bde49668a63ef6f1dac094ff76c41dc4574b0ac) | ![](/files/6eec1894fd2b56972b239a34fff998165f92aeb2) |
| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://rayneo.gitbook.io/rayneo-devdoc/chang-jian-wen-ti/adb-tiao-shi/adb-lian-jie-ji-tou-ping.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
