手動建構及執行可分析的應用程式
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
如要手動建構可分析的應用程式,您需要先建構發布版應用程式,接著更新其資訊清單檔案,將發布版應用程式轉換為可分析的應用程式。之後
設定可分析的應用程式、啟動分析器並選取
可分析的程序加以分析
建構發布版應用程式
如要建構發布版應用程式來方便完成分析,請按照下列步驟操作:
-
將下列程式碼新增至應用程式的 build.gradle
檔案中,以偵錯金鑰簽署應用程式。如果您已有運作中的發布建構變化版本,可直接跳到下一個步驟。
buildTypes {
release {
signingConfig signingConfigs.debug
}
}
-
在 Android Studio 中,依序選取「Build」>「Select Build Variant...」,然後選擇發布變化版本。
從發布版變更為可分析版
如要將發布版應用程式轉換為可分析的應用程式,請按照下列步驟操作:
-
開啟
AndroidManifest.xml
檔案並在
<application>
。詳情請參閱「建構要發布的應用程式」。
<profileable android:shell="true"/>
-
視 SDK 版本而定,您可能會看到與資訊清單相關的錯誤
驗證;若是無法解決的問題,並認為可以放心地處理
出現警告,請在
build.gradle
檔案。
aaptOptions {
additionalParameters =["--warn-manifest-validation"]
}
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[null,null,["上次更新時間:2025-07-27 (世界標準時間)。"],[],[],null,["# Build and run a profileable app manually\n\nTo build a [profileable](/studio/profile#requirements) application manually, you\nneed to first build a release application and then update its manifest file,\nwhich turns the release application into a profileable application. After you\nconfigure the profileable application, launch the profiler and select a\nprofileable process to analyze.\n\nBuild a release app\n-------------------\n\nTo build a release application for profiling purposes, do the following:\n\n\u003cbr /\u003e\n\n1. Sign your application with the debug key by adding the following lines to your application's\n `build.gradle` file. If you already have a working release build variant, you can\n skip to the next step.\n\n buildTypes {\n release {\n signingConfig signingConfigs.debug\n }\n }\n \n2. In Android Studio, select **Build** \\\u003e **Select Build Variant...** and choose the\n release variant.\n\n\u003cbr /\u003e\n\nChange release to profileable\n-----------------------------\n\nTo convert your [release app](#build-release-app) to a profileable app, do the\nfollowing:\n\n1. Open the\n `AndroidManifest.xml` file and adding the following within\n `\u003capplication\u003e`. For more details, see\n [Build your app for release](/studio/publish/preparing#publishing-build).\n\n `\u003cprofileable android:shell=\"true\"/\u003e`\n2. Depending on the SDK version, you might see an error related to manifest\n validation; if you can't resolve them and deem it safe to treat the errors\n as warnings, you can do so by adding the following lines to your\n `build.gradle` file.\n\n aaptOptions {\n additionalParameters =[\"--warn-manifest-validation\"]\n }"]]