> For the complete documentation index, see [llms.txt](https://help.autify.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.autify.com/nocode-mobile/using-autify-nocode-mobile/execution-environments/local-device/setup-procedure-for-recording-and-running-tests-on-a-local-device-android.md). Agents can also search and read this documentation through its [MCP server](https://help.autify.com/~gitbook/mcp).

# ローカル端末を使ったレコーディング・テスト実行のセットアップ手順 (Android)

## ローカル端末のセットアップ方法

### 0. 準備するもの

| 必要項目                       | 説明                                                          |
| -------------------------- | ----------------------------------------------------------- |
| Windows PC / Mac           | テスト制御用                                                      |
| Android 端末                 | ローカル実機端末。アプリケーションが実行可能であることをご確認ください。                        |
| 接続ケーブル                     | PC ↔ Android端末 接続する時に利用します。                                 |
| Autify NoCode Mobile アカウント | 　Autify NoCode Mobileにログインする時とAutify CLI 用トークンを取得する時に利用します。 |

### 1.Android Studioのインストールと初期設定 (\~1時間)

Autify NoCode MobileでAndroidローカル端末を使用するにはAndroid Studioと AndroidのSDKをインストールする必要があります。

#### Android studioのインストール

[こちら](https://developer.android.com/studio?hl=ja) から Android Studio をダウンロード、インストールしてください。

#### SDKのインストール

Android Studioを起動するとAndroid SDKをインストールためのダイアログが表示されます。 ”Standard” オプションを選択し、SDKをインストールしてください。

### 2. 端末で USBデバッグを有効にする (\~15分)

続いて、使用する端末で自動テストが実行できるよう USBデバッグを有効にします。

#### USBデバッグを有効にする

以下のページの指示に従い、端末でUSBデバッグを有効にしてください。

<https://developer.android.com/studio/debug/dev-options?hl=ja>

#### 端末とPCを接続する

USBデバッグを有効にした状態で端末をPCに接続すると、「この端末をUSBデバッグで許可しますか？」というダイアログが表示されるので、 許可してください。

その際、接続モードを **「ファイル転送（MTP）」または「PTP」モード** に切り替えてください

### 3.Autify CLIをインストール (\~15分)

端末とAutify NoCode Mobileを接続するために必要なアプリケーションをインストールします。

### Macの場合

#### Homebrewのインストール

Autify CLIのインストールにはHomebrewを使用します。

HomebrewはMacで各種ツールのインストールを簡単に行うことができるツールです。

Homebrewをインストールされていない場合はターミナルを開いて、以下のページの “Install Homebrew” というセクションに記載されているコマンドを実行してください。

<https://brew.sh/>

#### PATHの設定

Homebrewのインストール完了後、PATH変数を設定する必要があります。

ターミナルに以下のようなメッセージが表示されているかと思いますので、記載されているコマンドを実行してください(表示内容はマシンによって異なります)。

```bash
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/$USER/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
```

#### Autify CLIのインストール

Homebrewを使用してAutify CLIをインストールします。以下のコマンドをターミナルで実行してください。

```bash
brew install autifyhq/tap/autify-cli
```

もしインストール時にエラーが発生した場合、サポートまでお問い合わせください。

コマンドの実行が正常に完了したら、以下のコマンドを実行しAutify CLIが正常にダウンロードされていることを確認してください。

```bash
autify help
```

インストールが正常に完了している場合、 `Autify Command Line Interface (CLI)` というメッセージとバージョンや利用可能コマンドに関する情報が表示されます。

もし `command not found` というエラーメッセージが表示された場合、PATH変数が設定されていない可能性があります。 [PATHの設定](https://www.notion.so/PATH-21bccc10c8ed819fb294de0430a1fd16?pvs=21) を確認してください。

### Windowsの場合

以下のページよりAutify CLIをダウンロード、インストールしてください。

[Autify Command Line Interface (CLI)](https://help.autify.com/nocode-web/autify-university/integrations/autify-command-line-interface.md#native-installer)

インストールとPATH変数の設定が完了したら、以下のコマンドを実行しAutify CLIが正常に動作するか確認してください。

```bash
autify help
```

インストールが正常に完了している場合、 `Autify Command Line Interface (CLI)` というメッセージとバージョンや利用可能コマンドに関する情報が表示されます。

### 4.NoCode Mobileでパーソナルアクセストークンを生成する (\~5分)

Autify NoCode Mobileのユーザー設定画面 (<https://mobile-app.autify.com/settings/token>) からパーソナルアクセストークンを生成し、安全な場所に保存してください。このトークンは後のステップで利用します。

### 5.端末の接続準備を行う (\~15分)

#### モバイル端末接続のセットアップ

まずは前のステップで生成したパーソナルアクセストークンをAutify CLIに登録します。ターミナル (Windowsの場合はCommand Prompt / PowerShell) で以下のコマンドを実行して、パーソナルアクセストークンを設定してください。

```bash
autify mobile auth login
```

次に、以下のコマンドを実行してください。このコマンドは、モバイル端末をAutify NoCode Mobileに接続するために必要なコンポーネントをインストールし、必要な情報を設定します。

```bash
autify mobile link setup
```

画面に表示されるメッセージに従ってセットアップを完了してください。

* ワークスペースIDの入力

  ワークスペースIDは以下の手順で取得できます。

  * <http://mobile-app.autify.com/> にアクセスしてください。ログインするとURLが以下のように変化します。
  * “<https://mobile-app.autify.com/projects/XXXXXXX?by=test\\_plan”>
  * 変化したURLのXXXXXXの部分がワークスペースIDです
* レコーダーの画面クオリティの調整
  * 基本的には、**1. High** を選択していただいて問題ございませんが、レコーダーがフリーズする問題が発生した場合は、画質設定を **2. Low** にすることで解決することがあります。
    * [こちらの記事](https://help.autify.com/nocode-mobile/troubleshooting/trobleshooting-local-device/first-steps-to-try-if-an-error-occurs-before-starting-step-1.md#adjust-the-recorders-screen-quality)もご参考にされてください。
* データの送信同意
  * Yesと入力していただくと、レコーディング・テスト実行に関するログファイルがNoCode Mobileに送信され、よりスムーズなお問い合わせ対応が行えます。

### 6.接続開始

ターミナル (Windowsの場合はCommand Prompt / PowerShell) で以下のコマンドを実行すると、NoCode Mobileと端末が接続されます。

```bash
autify mobile link start
```

上記コマンド実行後、パーソナルアクセストークンを発行したユーザーでAutify NoCode Mobileにログインして、新規シナリオ作成画面を開いてください。

正常に接続できていた場合、モーダルウインドウ下部のドロップダウンで **Local Device** を選択すると端末名が表示されます。

![](https://1076629499-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fngfbmyfc37v4emfzEMM7%2Fuploads%2Fgit-blob-ba2f60d2186823ac43d5142655b63e7a82a1bd06%2Flocal_device_jp\(1\).png?alt=media)

## ローカル端末でのレコーディングとテスト実行

### 前提条件

ローカル端末を使ったシナリオのレコーディング・テスト実行を行う際には、USBが正常に接続されており、端末のロックが解除されていることを確認してください。

端末を継続して使用される場合、端末の設定から「画面表示と明るさ」を開き、「自動ロック」を「なし」に設定していただくと便利です。

{% hint style="warning" %}
**テスト実行中に端末がロックされている場合、テストに失敗します。** テスト実行前に端末のロックが解除されていることをご確認ください。
{% endhint %}

### レコーディング

上記「接続確認」のステップの手順を実行し、表示されている端末を選択してレコーディングを開始すると、手元の端末を使ったテストシナリオのレコーディングが行えます。

レコーディングの準備中にエラーが発生する場合、ビルドファイルがその端末にインストールできるよう設定されているか開発者に確認してください。それでも問題が解決しない場合、サポートまでお問い合わせください。

### テスト実行

クラウド端末同様、シナリオ詳細画面での「今すぐ実行」またはテストプランからローカル端末を使ったテストを実行できます。

## トラブルシューティング

[こちら](https://help.autify.com/nocode-mobile/troubleshooting/trobleshooting-local-device.md)の記事をご確認ください。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.autify.com/nocode-mobile/using-autify-nocode-mobile/execution-environments/local-device/setup-procedure-for-recording-and-running-tests-on-a-local-device-android.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
