# connect android

{% hint style="info" %}
**Mục tiêu**: kết nối ít nhất 1 thiết bị Android với MIN Automate qua ADB để chạy automation.\
**Thời gian**: 5-10 phút (lần đầu)\
**Yêu cầu**: thiết bị Android thật **HOẶC** giả lập Android trên PC
{% endhint %}

## Chọn loại thiết bị

| Loại                                 | Ưu                                           | Nhược                              | Phù hợp                        |
| ------------------------------------ | -------------------------------------------- | ---------------------------------- | ------------------------------ |
| **Điện thoại thật**                  | Render thật, anti-detect tốt                 | Tốn $$, không scale nhiều          | MMO Facebook/Instagram cao cấp |
| **Giả lập (LDPlayer, NoxPlayer...)** | Chạy 10-50 instance trên 1 PC mạnh, miễn phí | Có thể bị app phát hiện là giả lập | Đa số use case automation      |

{% hint style="success" %}
**Khuyến nghị cho người mới**: dùng **LDPlayer 9** vì miễn phí, dễ cài, MIN Automate hỗ trợ sẵn.
{% endhint %}

## Cách 1 — Kết nối điện thoại Android thật (qua USB)

{% stepper %}
{% step %}

## Bật USB Debugging trên điện thoại

1. Vào **Settings → About phone**
2. Tìm dòng **Build number** (hoặc **Số hiệu bản tạo**)
3. Nhấn liên tiếp **7 lần** → màn hình hiện thông báo **"You are now a developer!"**
4. Quay lại Settings → vào **Developer options** (mới hiện sau khi unlock)
5. Bật **USB debugging**
6. Bật thêm **Install via USB** nếu có (cho phép cài app qua ADB)

{% hint style="warning" %}
**Mỗi hãng đặt tên khác nhau**: Xiaomi → MIUI version (thay vì Build number); Samsung → Build number; Oppo/Realme → Version. Google "\[tên máy] bật USB Debugging" nếu không tìm thấy.
{% endhint %}
{% endstep %}

{% step %}

## Cắm USB vào PC

1. Cắm cáp USB điện thoại vào PC
2. Trên điện thoại, hiện popup **"Allow USB debugging from this computer?"**
3. Tick **Always allow from this computer**
4. Nhấn **OK / Allow**
   {% endstep %}

{% step %}

## Cài driver ADB (nếu cần)

Windows cần driver để nhận điện thoại qua ADB. Cách cài:

{% tabs %}
{% tab title="Cách 1: Google USB Driver (universal)" %}

1. Tải [Google USB Driver](https://developer.android.com/studio/run/win-usb)
2. Giải nén → vào Device Manager → tìm device chưa nhận → Update driver → chọn folder giải nén
   {% endtab %}

{% tab title="Cách 2: Driver hãng" %}
Mỗi hãng có driver riêng — tải đúng để hỗ trợ tốt nhất:

* **Samsung**: Samsung USB Driver / Smart Switch
* **Xiaomi**: Mi USB Driver
* **Oppo/Realme**: Oppo USB Driver
* **Huawei**: HiSuite
* **Vivo**: PC Suite
  {% endtab %}

{% tab title="Cách 3: Tự động qua Windows Update" %}

* Cắm USB → đợi Windows tự tìm driver (1-2 phút)
* Hoạt động với hầu hết máy Android 9+
  {% endtab %}
  {% endtabs %}
  {% endstep %}

{% step %}

## Kiểm tra trong MIN Automate

1. Mở MIN Automate → vào tab **Devices**
2. Nhấn nút **Reload** (icon ↻)
3. Thiết bị xuất hiện trong danh sách với:
   * **Serial** (chuỗi mã unique của máy)
   * **Model** (tên máy)
   * **Status: online**
     {% endstep %}
     {% endstepper %}

## Cách 2 — Kết nối giả lập Android

### LDPlayer 9 (khuyến nghị)

#### Cài LDPlayer

1. Tải LDPlayer: [https://www.ldplayer.net](https://www.ldplayer.net/)
2. Chạy installer → cài mặc định
3. Mở LDPlayer → tạo profile mới (Android 9 khuyến nghị)

#### Kích hoạt ADB trong LDPlayer

LDPlayer **mặc định đã bật ADB** — không cần làm gì thêm.

Kiểm tra:

1. Trong MIN Automate → tab **Devices** → nhấn **Reload**
2. LDPlayer xuất hiện với serial `emulator-5554` (hoặc tương tự)

{% hint style="info" %}
**Nhiều instance LDPlayer**: mỗi instance được cấp 1 ADB port khác nhau (`emulator-5554`, `emulator-5556`, `emulator-5558`...). Tất cả tự xuất hiện trong MIN Automate.
{% endhint %}

### NoxPlayer 7+

1. Tải NoxPlayer: [https://www.bignox.com](https://www.bignox.com/)
2. Sau khi cài, mở **NoxPlayer Multi-Drive** → tạo instance
3. NoxPlayer mặc định bật ADB ở port `62001`, `62025`, `62027`...
4. MIN Automate → Devices → Reload → NoxPlayer xuất hiện

### BlueStacks 5

BlueStacks **mặc định TẮT ADB**. Phải bật thủ công:

1. Mở BlueStacks → **Settings (⚙)** → **Advanced**
2. Tìm **Android Debug Bridge (ADB)** → bật ON
3. Ghi nhớ **Port** hiển thị (vd `5555`)
4. Restart BlueStacks
5. MIN Automate → Devices → Reload

### MEmu 9+

MEmu mặc định bật ADB. Port: `21503`, `21513`... tùy instance.

1. Mở MEmu → tạo instance → chạy
2. MIN Automate → Devices → Reload → MEmu xuất hiện

### MuMu Player 12

1. Cài MuMu → mở 1 instance Android 9+
2. ADB tự bật ở port `7555` (instance 1), `7556`...
3. MIN Automate → Devices → Reload

## Test kết nối — chụp ảnh màn hình

Để chắc thiết bị làm việc được:

1. Trong MIN Automate → tab **Devices** → chọn thiết bị
2. Nhấn nút **Screenshot** (icon máy ảnh)
3. Nếu hiện ảnh màn hình hiện tại của máy → kết nối OK ✅

## Xem điều khiển live (Screen Mirror)

MIN Automate cho phép xem màn hình điện thoại realtime trên PC:

1. Tab **Devices** → chọn thiết bị
2. Nhấn nút **View** (icon mắt)
3. Cửa sổ mới mở ra hiển thị màn hình live + cho phép điều khiển bằng chuột

## Lỗi thường gặp

<details>

<summary><strong>Reload không thấy thiết bị</strong></summary>

**Checklist**:

1. USB Debugging có bật? (xem Bước 1)
2. Đã nhấn **Allow** trên popup USB debugging chưa?
3. Cáp USB có truyền data? (cáp sạc rẻ tiền có thể chỉ truyền điện)
4. Driver Windows nhận device chưa? (mở **Device Manager** → tìm Android device)
5. Thử **đổi port USB** trên PC
6. Restart **ADB server**: mở cmd → `adb kill-server` rồi `adb start-server`

</details>

<details>

<summary><strong>Status: unauthorized</strong></summary>

**Nguyên nhân**: chưa nhấn Allow trên popup USB debugging.

**Xử lý**:

1. Trên điện thoại, kéo notification xuống → tìm thông báo USB
2. Đổi sang chế độ **File transfer** hoặc **PTP**
3. Popup USB debugging hiện lại → tick **Always allow** + nhấn OK

</details>

<details>

<summary><strong>Giả lập không xuất hiện sau khi mở</strong></summary>

**Xử lý**:

1. Đảm bảo giả lập đã boot xong (không còn loading screen)
2. Mở cmd → gõ `adb devices` → check có thấy giả lập không
   * Nếu thấy → MIN Automate có bug → restart MIN Automate
   * Nếu không → giả lập có vấn đề, restart giả lập
3. BlueStacks: kiểm tra ADB đã bật chưa
4. Conflict ADB port: tắt các tool khác đang dùng ADB (Vysor, scrcpy...)

</details>

<details>

<summary><strong>Thiết bị thật + giả lập cùng lúc bị conflict</strong></summary>

**Nguyên nhân**: ADB server đôi khi nhầm lẫn khi mix device thật + giả lập.

**Xử lý**:

1. Mở cmd → `adb kill-server`
2. Cắm device thật trước, đợi 5s
3. Mở giả lập sau, đợi boot
4. `adb devices` để verify
5. Mở MIN Automate → Reload

</details>

## Bước tiếp theo

{% content-ref url="/pages/81d7f92f432b507de6945f6cb8882cf43bfecb21" %}
[Broken mention](broken://pages/81d7f92f432b507de6945f6cb8882cf43bfecb21)
{% endcontent-ref %}

{% content-ref url="/pages/192e14a65efeaf3e0bb52cf295f4d47c8f49cf2b" %}
[Broken mention](broken://pages/192e14a65efeaf3e0bb52cf295f4d47c8f49cf2b)
{% endcontent-ref %}


---

# 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://docs.minautomate.com/bat-dau/connect-android.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.
