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

### Monaca デバッガーとのペアリングが失敗する場合 <a href="#monaca-debaggtonopearingugasuru" id="monaca-debaggtonopearingugasuru"></a>

Monaca デバッガーと ホスト PC のペアリングが失敗する場合、いくつかの理由が考えられます。

## Monaca デバッガー側はホスト PCを認識しているが、ペアリングが失敗する場合

多くの場合、ホスト PC 側のファイアーウォールに起因します。なお、ホスト PC とデバッガー間の通信には、TCP 接続を使用します。ポート番号は、`8001` です。待ち受けポートの変更方法に関しては、 [設定ダイアログ](/products_guide/monaca_localkit/overview.md#daiarogu) をご確認ください。ポート番号またはファイアーウォール設定の変更後は、再度、ペアリングをする必要があります。

## Monaca デバッガーが ホスト PC を認識していない場合

ホスト PC と端末が、同じネットワークに接続されているか確認します。同じネットワークに接続されているが、Monaca デバッガー側で、ホスト PC を検知できない場合には、次のように、手動でペアリングをします。

1. Monaca デバッガー画面の左上端に表示された切り替えメニューをタップして、次に、 `ローカルコンピュータ` ボタンをタップします。

![](/files/-MgZYBM64Inb2FYNqczG)

&#x20;   2\. コンピュータを手動で追加する ボタンをタップします。

&#x20;   3\. [ホスト PC の IP アドレスとポート番号](/products_guide/debugger/troubleshooting.md#ip-port) を入力して、`ペアリング`  ボタンをタップします。

![](/files/-MgZYKMI2opV3oQ7YeGw)

&#x20;   4\. ペアリング後、\[ ペアリング済み ] タブ下に、次のように、ホスト PC が表示されます。

![](/files/-MgZYMYrzEaeNg1Y_9jL)

{% hint style="info" %}
公共の Wi-Fi アクセスポイントでは、まれに、クライアント同士の接続を禁止しています。この場合、別のネットワーク環境を使用してください。
{% endhint %}

[**ホスト** **PC** **の** **IP** **アドレスとポート番号**](/products_guide/debugger/troubleshooting.md)

Monaca デバッガーと ホスト PC を接続する場合、IP アドレスとポート番号が必要です。IP アドレスは、ホスト PC の識別に使用するもので、ポート番号 ( デフォルトでは、8001 ) は、Monaca 提供のローカル環境用の開発ツール ( Monaca CLI、Monaca Localkit など ) 側が通信に使用するものです。また、ポートは、未使用であること ( 競合していないこと )、開放されていることが必要です。これ以外の場合、通信は確立できません。

{% hint style="info" %}
種類の異なる、Monaca 提供の開発ツールを、１台の PC 上で、複数起動させる場合、デフォルトのままでは、ポート番号が競合します。競合を避けるため、各ツールが使用するポート番号を適宜変更してください。
{% endhint %}

| OS　　　　      | Mac                                                                                                    | Windows                                                                                         |
| ----------- | ------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------- |
| **IP アドレス** | <p>IP アドレスの確認方法</p><ol><li>ターミナルを開きます。</li><li><code>ifconfig</code> と入力して、実行します。</li></ol>            | <p>IP アドレスの確認方法</p><ol><li>コマンドプロンプトを開きます。</li><li><code>ipconfig</code> と入力して、実行します。</li></ol> |
| **ポート番号**   | <p>ポート状態の確認方法</p><ol><li>ターミナルを開きます。</li><li><code>lsof -i :PORT\_NUMBER</code> と入力して、実行します。</li></ol> | <p>ポート状態の確認方法</p><ol><li>コマンドプロンプトを開きます。</li><li><code>netstat</code> と入力して、実行します。</li></ol>    |

## Android 9 以降でペアリングに失敗する場合

Android 9 以降でカスタムビルドデバッガーを使用する場合は、`config.xml` の `widget` タグに `andorid 名前空間` 設定を追加し、`usesCleartextTraffic` 設定を追加する必要があります。

`config.xml` に以下の設定を追加後、カスタムビルドデバッガーを作成してください。

{% hint style="info" %}
Android カスタムビルドデバッガー v9.0.1 以降をご利用の場合は、下記の設定は必要ありません。
{% endhint %}

```markup
<widget xmlns:android="http://schemas.android.com/apk/res/android">

<platform name="android">
  <edit-config file="AndroidManifest.xml" target="/manifest/application" mode="merge">
    <application android:usesCleartextTraffic="true" />
  </edit-config>
</platform>
```

参考ページ

* [インストール方法](/products_guide/debugger/installation.md)
* [使用例](/products_guide/debugger/debug.md)
* [機能の概要](/products_guide/debugger/features.md)


---

# 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://ja.docs.monaca.io/products_guide/debugger/troubleshooting.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.
