[null,null,["最終更新日 2025-07-27 UTC。"],[],[],null,["# Confirm Startup Profiles optimization\n\nYou can check that your Startup Profiles are working using either Android Studio\nor looking at the R8 build metadata.\n\nConfirm with Android Studio\n---------------------------\n\nTo confirm DEX layout optimization, use Android Studio to open the APK and\nverify the classes in the DEX files. Make sure the primary `classes.dex` isn't\ncompletely filled. If your app consists of a single DEX file, you can check\nwhether the app contains two DEX files after enabling the Startup Profile.\n\nAndroid Studio warns you if the startup classes don't fit in a single DEX file.\nTo get diagnostic information that includes the amount of non-startup methods in\nthe startup classes, make sure the R8 compiler is updated to at least version\n8.3.36-dev by making the following changes to the `settings.gradle` file when\nyou apply the Startup Profile: \n\n### Kotlin\n\n```kotlin\npluginManagement {\n buildscript {\n repositories {\n mavenCentral()\n maven {\n url = uri(\"https://storage.googleapis.com/r8-releases/raw\")\n }\n }\n dependencies {\n classpath(\"com.android.tools:r8:8.3.6-dev\")\n }\n }\n}\n```\n\n### Groovy\n\n```groovy\npluginManagement {\n buildscript {\n repositories {\n mavenCentral()\n maven {\n url uri('https://storage.googleapis.com/r8-releases/raw')\n }\n }\n dependencies {\n classpath 'com.android.tools:r8:8.3.6-dev\"\n }\n }\n}\n```\n\nMake sure you add `--info` after\n`assembleRelease` in the following command when building with Gradle. \n\n ./gradlew assembleRelease --info\n\nThe diagnostic is then printed to the terminal.\n\nIf your app or any libraries reference any [desugared APIs](/studio/write/java8-support#library-desugaring), the bundled\ncompatibility implementations of these classes are always contained in the last\nDEX file. This desugared last DEX file doesn't participate in DEX layout\noptimizations.\n\nConfirm with bundle metadata\n----------------------------\n\n| **Note:** This workflow has only been tested on Linux.\n\nStarting with AGP 8.8, R8 outputs metadata in your Android App Bundle (AAB) that\nyou can use to check if the DEX layout optimization was successful. To check if\nthe optimization worked, do the following:\n\n1. Build your app's AAB:\n\n ./gradlew app:bundleRelease\n\n2. Check that there's at least one DEX file that contains the text\n `\"startup\": true`.\n\n 1. Open the metadata:\n\n unzip -j -o \u003cvar translate=\"no\"\u003epath-to-aab\u003c/var\u003e BUNDLE-METADATA/com.android.tools/r8.json && jq .dexFiles r8.json\n\n The path to your AAB might be something like\n `app/build/outputs/bundle/release/app-release.aab`.\n 2. Check the output, which should look something like this:\n\n inflating: r8.json\n [\n {\n \"checksum\": \"f0b4b0ddb295812607f44efe03cf7a830056ccfddbdb81db3760d2281940e951\",\n \"startup\": true\n }\n ]\n\n If you only see `\"startup\": false` in the metadata, you need to\n [enable startup profiles](/topic/performance/baselineprofiles/dex-layout-optimizations#create-startup) and ensure that your startup\n profile isn't obfuscated.\n3. Check that the SHA-256 values from the metadata match those from the AAB. To\n get the SHA-256 values for all your DEX files run the following:\n\n unzip -o \u003cvar translate=\"no\"\u003epath-to-aab\u003c/var\u003e */dex/*.dex && sha256sum */dex/*\n\n The output should look something like this: \n\n Archive: app/build/outputs/bundle/release/myapp-release.aab\n inflating: base/dex/classes.dex\n f0b4b0ddb295812607f44efe03cf7a830056ccfddbdb81db3760d2281940e951 base/dex/classes.dex\n\n Compare the hash values to the \"checksum\" values from step 1. If the SHA-256\n values don't match, there might be a compilation step interfering with R8's\n ability to output DEX files."]]