Android アプリでのランタイム動作とパフォーマンスの問題のトラブルシューティングを行う場合、ARCore API 呼び出しを Android デバイスログに記録できます。
コールロギングを有効にすると、アプリがビルドされた SDK に関係なく、ARCore はすべての API 呼び出しを C API 名でログに記録します。すべての C API 名は、パラメータおよび戻り値とともに、C API リファレンス ドキュメントで確認できます。
API 呼び出しロギングを有効にする
*_destroy
関数や *_release
関数などの ArSession*
パラメータを受け取らない ARCore API 呼び出しはログに記録されません。
ARCore API 呼び出しロギングを有効にする手順は次のとおりです。
Google Play 開発者サービス(ARCore)1.23 以降がインストールされていることを確認します。
- Windows の場合は、
adb shell pm dump com.google.ar.core | findstr /i "packages: versionName"
を実行します。 - macOS の場合は、
adb shell pm dump com.google.ar.core | egrep -i versionName\|packages:
を実行します。
- Windows の場合は、
アプリで AR エクスペリエンスを開き、アクティブな ARCore セッションが実行されているようにします。ロギングを有効にするブロードキャストを受信するには、アプリが AR モードになっている必要があります。AR カメラのプレビュー画像がデバイスの画面に表示されます。
アプリのコールロギングを有効にするには、次のアクティビティ マネージャーのブロードキャスト コマンドを使用します。
# Enables ARCore call logging and saves a setting to your app's
# Android Shared Preferences, so that call logging remains enabled in
# subsequent ARCore sessions.
# Your app must have an actively running ARCore session to receive the broadcast.
adb shell am broadcast -a com.google.ar.core.ENABLE_API_CALL_LOGGING
API 呼び出しロギングを無効化する
ARCore API 呼び出しロギングを無効にする手順は次のとおりです。
アプリで AR エクスペリエンスを開き、アクティブな ARCore セッションが実行されているようにします。ロギングを無効にするブロードキャストを受信するには、アプリが AR モードになっている必要があります。AR カメラのプレビュー画像がデバイスの画面に表示されます。
アプリのコールロギングを無効にするには、次のアクティビティ マネージャーのブロードキャスト コマンドを使用します。
# Disables ARCore call logging and saves a setting to your app's
# Android Shared Preferences, so that call logging remains disabled in
# subsequent ARCore sessions.
# Your app must have an actively running ARCore session to receive the broadcast.
adb shell am broadcast -a com.google.ar.core.DISABLE_API_CALL_LOGGING
出力の表示
ARCore は、すべての ARCore API ロギング出力に ARCore-Api
タグを使用します。これらの呼び出しのみをフィルタリングするには、次のコマンドを使用します。
# Currently, ARCore only logs API calls that take an `ArSession*` argument.
# Functions that do not take session parameters such as `*_destroy` and `*_release` are not logged.
# -s is equivalent to the filter expression '*:S', which sets priority for all tags to silent.
adb logcat -s ARCore-Api
ARCore は、ログスパムを減らすために出力のレート制限を行います。スキップされたログメッセージは 1 つのログメッセージに集約されます。
スキップされたログメッセージの出力例:
D ARCore-Api: ArFrame_create(<ptr>)
D ARCore-Api: ArSession_update(<ptr>) -> AR_SUCCESS
D ARCore-Api: ArFrame_acquireCamera(<ptr>, <ptr>)
D ARCore-Api: ArFrame_getDisplayGeometryChanged(<ptr>, <ptr>)
D ARCore-Api: ArCamera_getTrackingFailureReason(<ptr>, <ptr>)
D ARCore-Api: ArFrame_getTimestamp(<ptr>, <ptr>)
D ARCore-Api: ArSession_setDisplayGeometry(0, 1080, 2195)
D ARCore-Api: ArFrame_create(<ptr>) (suppressing for 10s)
D ARCore-Api: ArSession_update(<ptr>) -> AR_SUCCESS (suppressing for 10s)
D ARCore-Api: ArFrame_acquireCamera(<ptr>, <ptr>) (suppressing for 10s)
D ARCore-Api: ArFrame_getDisplayGeometryChanged(<ptr>, <ptr>) (suppressing for 10s)
D ARCore-Api: ArCamera_getTrackingFailureReason(<ptr>, <ptr>) (suppressing for 10s)
D ARCore-Api: ArFrame_getTimestamp(<ptr>, <ptr>) (suppressing for 10s)
D ARCore-Api: ArSession_setDisplayGeometry(0, 1080, 2195) (suppressing for 10s)