應用程式檢索器
透過集合功能整理內容
你可以依據偏好儲存及分類內容。

使用 Jetpack 內附的 App Crawler 工具自動測試應用程式,無須撰寫或維護任何程式碼。
這款檢索器可以與您的應用程式一起執行,自動發出動作 (輕觸、滑動等),以探索應用程式的狀態空間。當已經沒有可以執行的獨特操作、應用程式異常終止,或是已到了您指定的逾時時間後,檢索器會自動終止。
使用檢索器無需撰寫或維護程式碼,讓您輕鬆進行測試。此外,您也可以用多種裝置執行檢索器,以便偵測停止運作、外觀問題或效能問題。一般情況下,建議您使用雲端式服務 (如 Firebase Test Lab),以便用更輕鬆、快速的方式測試多種螢幕大小和硬體設定的組合。
目標對象
App Crawler 的對象是針對想用最少設定來確定應用程式基礎功能的開發人員。除了進行純粹的不透明箱測試之外,這個檢索器也能透過設定提供特定的輸入內容,如登入憑證或深層連結。
開始使用
開始使用之前,請先確認您有最新版的 Android SDK。Android Studio 內有隨附。如果您安裝的是獨立的 Android SDK,請確定裡面有最新版的建構工具和平台工具。
然後請下載檢索器二進位檔封存檔。
接下來,您可以啟動模擬器,或用 USB 傳輸線連接實體裝置。執行以下指令,確認裝置連接完畢:
adb devices
若要叫用檢索器,先將封存檔解壓縮到任意目錄內。使用以下指令從該目錄叫用檢索器:
java -jar crawl_launcher.jar --apk-file path/to/my/app.apk --android-sdk path/to/my/android/sdk
檢索器選項
您可以用以下選項叫用檢索器:
選項 | 說明 |
--android-sdk path
|
指定 Android SDK 的路徑。
這是必要旗標,
|
--apk-file file
|
指定應用程式 APK 路徑,App Crawler 會用來安裝及檢索。
如果您沒有指定 --app-package-name ,那麼這是必要旗標。
|
--app-package-name name
|
指定應用程式套件名稱。如果您的應用程式已經安裝在裝置上,而且不需要重新安裝,就可以使用此選項。
如果您沒有指定 --apk-file ,那麼這是必要旗標。
|
--key-store path
|
指定簽署應用程式和檢索器 APK 的 KeyStore 路徑。如果您的應用程式需要特定的簽名才能正確運作,請使用此選項。
|
--key-store-password password
|
指定您為 --key-store 選項提供的 KeyStore 密碼。
如果您有指定 --key-store ,那麼這是必要旗標。
|
--timeout-sec timeout
|
指定檢索逾時時間 (秒)。如果沒有指定的話,檢索會在 60 秒後結束。
|
已知問題
無法刪除原始簽名檔案
檢索開始之前,JDK 9 使用者可能會看到這則錯誤訊息:
androidx.test.tools.crawler.launcher.exceptions.ApkSigningException: Failed to delete original signature files
發生這種行為時,建議您使用 JDK 8 或 10+。若要詳細瞭解此問題,請參閱此「JDK 9 錯誤」。部分使用者在使用更新版本的 Android Studio 重新建構 APK 後即可修正此問題。
其他資源
若要進一步瞭解如何使用 App Crawler,請參閱以下資源。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[null,null,["上次更新時間:2025-07-27 (世界標準時間)。"],[],[],null,["# App Crawler\n\nUse the App Crawler tool, part of [Jetpack](/jetpack), to automatically test\nyour app without the need to write or maintain any code.\n\nThe crawler runs alongside your app, automatically issuing actions\n(tap, swipe, etc.) to explore the state-space of your app.\nThe crawl terminates automatically when there are no more unique actions to\nperform, the app crashes, or a timeout you designate is reached.\n\nTesting with the crawler is easy because there's no code to write or maintain.\nMoreover, you can run it on a variety of devices to look for crashes, visual\nissues, or performance problems. Typically, it's a good idea to use a\ncloud-based service like [Firebase Test\nLab](https://firebase.google.com/docs/test-lab/) to test multiple combinations\nof screen sizes and hardware configurations more easily and quickly.\n\nTarget audience\n---------------\n\nApp Crawler is targeted at developers who want to ensure their app's basic\nfunctionality with minimal configuration. In addition to purely opaque-box\ntesting, the crawler can also be configured to provide specific inputs,\nsuch as login credentials or deep links.\n\nGetting started\n---------------\n\nBefore starting, make sure you have a recent version of the Android SDK.\nThis comes with [Android Studio](/studio).\nIf you install a standalone Android SDK, make sure it includes the latest\nlatest build tools and platform tools.\n\nThen, [download the crawler binary\narchive](https://dl.google.com/appcrawler/beta1/app-crawler.zip).\n\nNext, either start an emulator or connect a physical device using a USB cable.\nConfirm the device is connected by running the following command: \n\n```\nadb devices\n```\n\nTo invoke the crawler, first extract the archive to the directory of your\nchoice. From that directory, invoke the crawler using the following command: \n\n```\njava -jar crawl_launcher.jar --apk-file path/to/my/app.apk --android-sdk path/to/my/android/sdk\n```\n\nCrawler options\n---------------\n\nYou can use the following options to invoke the crawler:\n\n| Option | Description |\n|-----------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `--android-sdk `\u003cvar translate=\"no\"\u003epath\u003c/var\u003e | Specifies the path to your Android SDK. This is a **required** flag. |\n| `--apk-file `\u003cvar translate=\"no\"\u003efile\u003c/var\u003e | Specifies the path to your app APK, which App Crawler then installs and crawls. This is a **required** flag if `--app-package-name` isn't specified. |\n| `--app-package-name `\u003cvar translate=\"no\"\u003ename\u003c/var\u003e | Specifies the package name of your app. Use this option when your app is already installed on the device and no re-installation is required. This is a **required** flag if `--apk-file` isn't specified. |\n| `--key-store `\u003cvar translate=\"no\"\u003epath\u003c/var\u003e | Specifies the path to the keystore that signs your app and crawler APKs. Use this option when your app requires a specific signature to function properly. |\n| `--key-store-password `\u003cvar translate=\"no\"\u003epassword\u003c/var\u003e | Specifies the password for the keystore you provided for `--key-store` option. This is a **required** flag if `--key-store` is specified. |\n| `--timeout-sec `\u003cvar translate=\"no\"\u003etimeout\u003c/var\u003e | Specifies the timeout for your crawl in seconds. If not specified, the crawl stops after 60 seconds. |\n\nKnown issues\n------------\n\n**Failed to delete original signature files**\n\nPrior to the start of the crawl, JDK 9 users may see this error message: \n\n```\nandroidx.test.tools.crawler.launcher.exceptions.ApkSigningException: Failed to delete original signature files\n```\n\nIf you experience this behavior, we recommend using JDK 8 or 10+. For more\ninformation on this issue, see this\n[JDK 9 bug](https://bugs.openjdk.java.net/browse/JDK-8184940).\nSome users have fixed the issue by rebuilding their APK using an updated version\nof Android Studio.\n\nAdditional resources\n--------------------\n\nFor more information about using App Crawler, consult the\nfollowing resources.\n\n- [Firebase Test Lab Robo Test](https://firebase.google.com/docs/test-lab/android/robo-ux-test) contains detailed documentation as well as instructions for how to run crawler tests in the cloud."]]