reis-mobile 0.3.6 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +24 -0
- package/README.md +175 -168
- package/THIRD_PARTY_NOTICES.md +224 -4
- package/agents/android-architect.md +89 -0
- package/agents/android-performance-engineer.md +92 -0
- package/agents/android-test-engineer.md +97 -0
- package/agents/flutter-test-engineer.md +2 -0
- package/agents/ios-architect.md +93 -0
- package/agents/ios-performance-engineer.md +92 -0
- package/agents/ios-test-engineer.md +95 -0
- package/agents/lead-mobile.md +10 -1
- package/agents/mobile-staff-engineer.md +1 -1
- package/agents/rn-architect.md +94 -0
- package/agents/rn-performance-engineer.md +92 -0
- package/agents/rn-test-engineer.md +98 -0
- package/bin/reis-mobile.mjs +59 -17
- package/commands/debate.md +10 -1
- package/commands/debug.md +60 -0
- package/commands/reis-mobile.md +7 -2
- package/core/config/project.mjs +59 -0
- package/core/registry/frontmatter.mjs +15 -4
- package/core/registry/registry.mjs +21 -1
- package/core/router/intents.mjs +2 -0
- package/core/router/router.mjs +10 -5
- package/package.json +1 -1
- package/skills/android-adaptive/SKILL.md +304 -0
- package/skills/android-adaptive/references/android/develop/ui/compose/layouts/adaptive/flexbox/container-behavior.md +112 -0
- package/skills/android-adaptive/references/android/develop/ui/compose/layouts/adaptive/flexbox/get-started.md +69 -0
- package/skills/android-adaptive/references/android/develop/ui/compose/layouts/adaptive/flexbox/index.md +81 -0
- package/skills/android-adaptive/references/android/develop/ui/compose/layouts/adaptive/flexbox/item-behavior.md +170 -0
- package/skills/android-adaptive/references/android/develop/ui/compose/layouts/adaptive/grid/container-properties.md +415 -0
- package/skills/android-adaptive/references/android/develop/ui/compose/layouts/adaptive/grid/get-started.md +51 -0
- package/skills/android-adaptive/references/android/develop/ui/compose/layouts/adaptive/grid/index.md +73 -0
- package/skills/android-adaptive/references/android/develop/ui/compose/layouts/adaptive/grid/item-properties.md +170 -0
- package/skills/android-adaptive/references/android/develop/ui/compose/layouts/adaptive/mediaquery/index.md +333 -0
- package/skills/android-adaptive/references/android/develop/ui/compose/tooling/debug.md +114 -0
- package/skills/android-adaptive/references/android/guide/navigation/navigation-3/recipes/material-listdetail.md +141 -0
- package/skills/android-agp-9-upgrade/SKILL.md +106 -0
- package/skills/android-agp-9-upgrade/references/android/build/migrate-to-built-in-kotlin.md +416 -0
- package/skills/android-agp-9-upgrade/references/android/build/releases/agp-9-0-0-release-notes.md +554 -0
- package/skills/android-agp-9-upgrade/references/buildconfig.md +54 -0
- package/skills/android-agp-9-upgrade/references/ksp-kapt.md +39 -0
- package/skills/android-agp-9-upgrade/references/paparazzi-gradle-9.md +30 -0
- package/skills/android-agp-9-upgrade/references/recipes.md +62 -0
- package/skills/android-appfunctions/SKILL.md +74 -0
- package/skills/android-appfunctions/references/adb-interaction-testing.md +95 -0
- package/skills/android-appfunctions/references/context.md +26 -0
- package/skills/android-appfunctions/references/feature-discovery-analysis.md +71 -0
- package/skills/android-appfunctions/references/implementation-configuration.md +282 -0
- package/skills/android-appfunctions/references/kdoc-refinement-optimization.md +75 -0
- package/skills/android-appfunctions/references/migrate-to-service-entry-point.md +226 -0
- package/skills/android-camerax/SKILL.md +135 -0
- package/skills/android-camerax/references/camera1-to-camerax.md +198 -0
- package/skills/android-camerax/references/camera2-to-camerax.md +193 -0
- package/skills/android-camerax/references/expert-blueprints.md +58 -0
- package/skills/android-camerax/references/foldables.md +83 -0
- package/skills/android-camerax/references/immutability.md +60 -0
- package/skills/android-camerax/references/low-light.md +124 -0
- package/skills/android-camerax/references/mlkit-spatial.md +75 -0
- package/skills/android-camerax/references/modern-apis.md +42 -0
- package/skills/android-camerax/references/testing.md +69 -0
- package/skills/android-camerax/references/thermals.md +85 -0
- package/skills/android-camerax/references/wear-os.md +76 -0
- package/skills/android-camerax/references/xr.md +54 -0
- package/skills/android-cli/SKILL.md +474 -0
- package/skills/android-cli/references/interact.md +113 -0
- package/skills/android-cli/references/journeys.md +120 -0
- package/skills/android-code-review/SKILL.md +58 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/SKILL.md +340 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/references/android/design/ui/ai-glasses/guides/interaction/inputs.md +67 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/references/android/develop/xr/jetpack-xr-sdk/access-hardware-projected-context.md +388 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/references/android/develop/xr/jetpack-xr-sdk/jetpack-compose-glimmer/buttons.md +139 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/references/android/develop/xr/jetpack-xr-sdk/jetpack-compose-glimmer/cards.md +148 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/references/android/develop/xr/jetpack-xr-sdk/jetpack-compose-glimmer/focus.md +107 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/references/android/develop/xr/jetpack-xr-sdk/jetpack-compose-glimmer/icons.md +90 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/references/android/develop/xr/jetpack-xr-sdk/jetpack-compose-glimmer/text.md +69 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/references/android/develop/xr/jetpack-xr-sdk/jetpack-compose-glimmer/title-chips.md +82 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/references/android/develop/xr/jetpack-xr-sdk/request-hardware-permissions.md +213 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/references/button-samples-source.md +176 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/references/button-source.md +203 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/references/card-samples-source.md +296 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/references/card-source.md +515 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/references/deptheffect-source.md +224 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/references/deptheffectlevels-source.md +105 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/references/glimmersansflextypography-source.md +270 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/references/glimmertheme-source.md +182 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/references/icon-source.md +388 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/references/iconbutton-source.md +126 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/references/iconsizes-source.md +78 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/references/list-source.md +27 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/references/listitem-source.md +272 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/references/liststate-source.md +427 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/references/material-hct-source.md +217 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/references/projectedcontext-source.md +265 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/references/stack-source.md +368 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/references/stackitemscope-source.md +440 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/references/stackstate-source.md +325 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/references/surface-source.md +1211 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/references/titlechip-samples-source.md +101 -0
- package/skills/android-display-glasses-with-jetpack-compose-glimmer/references/titlechip-source.md +131 -0
- package/skills/android-edge-to-edge/SKILL.md +429 -0
- package/skills/android-engage-sdk-integration/SKILL.md +130 -0
- package/skills/android-engage-sdk-integration/references/android/guide/playcore/engage/faq.md +439 -0
- package/skills/android-engage-sdk-integration/references/android/guide/playcore/engage/food.md +1149 -0
- package/skills/android-engage-sdk-integration/references/android/guide/playcore/engage/healthandfitness.md +1055 -0
- package/skills/android-engage-sdk-integration/references/android/guide/playcore/engage/listen.md +1050 -0
- package/skills/android-engage-sdk-integration/references/android/guide/playcore/engage/otherverticals.md +1301 -0
- package/skills/android-engage-sdk-integration/references/android/guide/playcore/engage/read.md +910 -0
- package/skills/android-engage-sdk-integration/references/android/guide/playcore/engage/shopping.md +1224 -0
- package/skills/android-engage-sdk-integration/references/android/guide/playcore/engage/social.md +719 -0
- package/skills/android-engage-sdk-integration/references/android/guide/playcore/engage/travel.md +1413 -0
- package/skills/android-engage-sdk-integration/references/android/guide/playcore/engage/tv/continue-watching/index.md +19 -0
- package/skills/android-engage-sdk-integration/references/android/guide/playcore/engage/tv/entitlements.md +353 -0
- package/skills/android-engage-sdk-integration/references/android/guide/playcore/engage/tv/getting-started.md +202 -0
- package/skills/android-engage-sdk-integration/references/android/guide/playcore/engage/tv/recommendations.md +471 -0
- package/skills/android-engage-sdk-integration/references/android/guide/playcore/engage/watch.md +1081 -0
- package/skills/android-engage-sdk-integration/references/clusters.md +154 -0
- package/skills/android-engage-sdk-integration/references/common.md +519 -0
- package/skills/android-engage-sdk-integration/references/patterns.md +527 -0
- package/skills/android-engage-sdk-integration/references/requests.md +260 -0
- package/skills/android-engage-sdk-integration/references/schemas/food.md +509 -0
- package/skills/android-engage-sdk-integration/references/schemas/listen.md +842 -0
- package/skills/android-engage-sdk-integration/references/schemas/other.md +220 -0
- package/skills/android-engage-sdk-integration/references/schemas/read.md +412 -0
- package/skills/android-engage-sdk-integration/references/schemas/shopping.md +357 -0
- package/skills/android-engage-sdk-integration/references/schemas/social.md +228 -0
- package/skills/android-engage-sdk-integration/references/schemas/travel.md +923 -0
- package/skills/android-engage-sdk-integration/references/schemas/tv.md +1226 -0
- package/skills/android-engage-sdk-integration/references/schemas/watch.md +1137 -0
- package/skills/android-engage-sdk-integration/references/troubleshooting.md +39 -0
- package/skills/android-gradle-build-debug/SKILL.md +71 -0
- package/skills/android-intent-security/SKILL.md +550 -0
- package/skills/android-leanback-to-compose-tv-migration/SKILL.md +743 -0
- package/skills/android-leanback-to-compose-tv-migration/references/android/training/tv/get-started/navigation.md +372 -0
- package/skills/android-leanback-to-compose-tv-migration/references/android/training/tv/playback/compose/browse.md +243 -0
- package/skills/android-leanback-to-compose-tv-migration/references/android/training/tv/playback/compose/index.md +153 -0
- package/skills/android-media3-cast-integration/SKILL.md +236 -0
- package/skills/android-media3-cast-integration/references/android/media/media3/cast/create-castplayer.md +390 -0
- package/skills/android-media3-cast-integration/references/android/media/media3/cast/customize-castoptions.md +93 -0
- package/skills/android-media3-cast-integration/references/android/media/media3/cast/index.md +21 -0
- package/skills/android-migrate-xml-views-to-jetpack-compose/SKILL.md +127 -0
- package/skills/android-migrate-xml-views-to-jetpack-compose/references/analysis-of-the-project-and-layout.md +42 -0
- package/skills/android-migrate-xml-views-to-jetpack-compose/references/android/develop/ui/compose/designsystems/migrate-xml-theme-to-compose.md +171 -0
- package/skills/android-migrate-xml-views-to-jetpack-compose/references/android/develop/ui/compose/migrate/interoperability-apis/compose-in-views.md +299 -0
- package/skills/android-migrate-xml-views-to-jetpack-compose/references/android/develop/ui/compose/migrate/interoperability-apis/views-in-compose.md +286 -0
- package/skills/android-migrate-xml-views-to-jetpack-compose/references/android/develop/ui/compose/setup-compose-dependencies-and-compiler.md +197 -0
- package/skills/android-migrate-xml-views-to-jetpack-compose/references/identify-optimal-xml-candidate.md +31 -0
- package/skills/android-migrate-xml-views-to-jetpack-compose/references/xml-layout-migration.md +86 -0
- package/skills/android-ml-kit-genai-prompt-api/SKILL.md +124 -0
- package/skills/android-ml-kit-genai-prompt-api/references/get-started.md +272 -0
- package/skills/android-ml-kit-genai-prompt-api/references/prefix-caching.md +146 -0
- package/skills/android-ml-kit-genai-prompt-api/references/prompt-design.md +55 -0
- package/skills/android-ml-kit-genai-prompt-api/references/prompt-optimization.md +74 -0
- package/skills/android-ml-kit-genai-prompt-api/references/structured-output.md +219 -0
- package/skills/android-ml-kit-genai-prompt-api/references/system-instructions.md +71 -0
- package/skills/android-navigation-3/SKILL.md +122 -0
- package/skills/android-navigation-3/references/android/guide/navigation/navigation-3/index.md +51 -0
- package/skills/android-navigation-3/references/android/guide/navigation/navigation-3/migration-guide.md +670 -0
- package/skills/android-navigation-3/references/android/guide/navigation/navigation-3/recipes/animations.md +147 -0
- package/skills/android-navigation-3/references/android/guide/navigation/navigation-3/recipes/basic.md +89 -0
- package/skills/android-navigation-3/references/android/guide/navigation/navigation-3/recipes/basicdsl.md +85 -0
- package/skills/android-navigation-3/references/android/guide/navigation/navigation-3/recipes/basicsaveable.md +90 -0
- package/skills/android-navigation-3/references/android/guide/navigation/navigation-3/recipes/bottomsheet.md +195 -0
- package/skills/android-navigation-3/references/android/guide/navigation/navigation-3/recipes/common-ui.md +200 -0
- package/skills/android-navigation-3/references/android/guide/navigation/navigation-3/recipes/conditional-transitions.md +182 -0
- package/skills/android-navigation-3/references/android/guide/navigation/navigation-3/recipes/conditional.md +230 -0
- package/skills/android-navigation-3/references/android/guide/navigation/navigation-3/recipes/deeplinks-custommatcher.md +176 -0
- package/skills/android-navigation-3/references/android/guide/navigation/navigation-3/recipes/deeplinks-staticuri.md +140 -0
- package/skills/android-navigation-3/references/android/guide/navigation/navigation-3/recipes/deeplinks-syntheticbackstack.md +184 -0
- package/skills/android-navigation-3/references/android/guide/navigation/navigation-3/recipes/dialog.md +107 -0
- package/skills/android-navigation-3/references/android/guide/navigation/navigation-3/recipes/lifecycle-owner.md +185 -0
- package/skills/android-navigation-3/references/android/guide/navigation/navigation-3/recipes/material-listdetail.md +141 -0
- package/skills/android-navigation-3/references/android/guide/navigation/navigation-3/recipes/material-supportingpane.md +145 -0
- package/skills/android-navigation-3/references/android/guide/navigation/navigation-3/recipes/modular-hilt.md +283 -0
- package/skills/android-navigation-3/references/android/guide/navigation/navigation-3/recipes/modular-koin.md +287 -0
- package/skills/android-navigation-3/references/android/guide/navigation/navigation-3/recipes/multiple-backstacks.md +468 -0
- package/skills/android-navigation-3/references/android/guide/navigation/navigation-3/recipes/passingarguments.md +371 -0
- package/skills/android-navigation-3/references/android/guide/navigation/navigation-3/recipes/results-event.md +273 -0
- package/skills/android-navigation-3/references/android/guide/navigation/navigation-3/recipes/results-state.md +266 -0
- package/skills/android-navigation-3/references/android/guide/navigation/navigation-3/recipes/scenes-listdetail.md +435 -0
- package/skills/android-navigation-3/references/android/guide/navigation/navigation-3/recipes/scenes-twopane.md +244 -0
- package/skills/android-navigation-3/references/android/guide/navigation/type-safe-destinations.md +129 -0
- package/skills/android-navigation-event/SKILL.md +312 -0
- package/skills/android-navigation-event/references/android/guide/navigation/navigation-event/dispatcher.md +134 -0
- package/skills/android-navigation-event/references/android/guide/navigation/navigation-event/handle-back.md +217 -0
- package/skills/android-navigation-event/references/android/guide/navigation/navigation-event/index.md +83 -0
- package/skills/android-navigation-event/references/android/guide/navigation/navigation-event/setup.md +32 -0
- package/skills/android-play-billing-library-version-upgrade/SKILL.md +96 -0
- package/skills/android-play-billing-library-version-upgrade/references/android/google/play/billing/release-notes.md +1240 -0
- package/skills/android-play-billing-library-version-upgrade/references/migration-logic.md +78 -0
- package/skills/android-play-billing-library-version-upgrade/references/version-checklist.md +54 -0
- package/skills/android-play-policy-insights/SKILL.md +172 -0
- package/skills/android-play-policy-insights/resources/common_mandates.md +100 -0
- package/skills/android-play-policy-insights/resources/compliance_report_template.md +59 -0
- package/skills/android-play-policy-insights/resources/critic.md +86 -0
- package/skills/android-play-policy-insights/resources/goal_data_safety.md +212 -0
- package/skills/android-play-policy-insights/resources/goal_permissions_and_apis.md +459 -0
- package/skills/android-play-policy-insights/resources/goal_user_account.md +106 -0
- package/skills/android-play-policy-insights/resources/policies.json +321 -0
- package/skills/android-play-policy-insights/resources/scanner_config.json +843 -0
- package/skills/android-play-policy-insights/scripts/generate_report.py +860 -0
- package/skills/android-play-policy-insights/scripts/orchestrator.py +1313 -0
- package/skills/android-play-policy-insights/scripts/play_store_scraper.py +410 -0
- package/skills/android-play-policy-insights/scripts/scanner.py +261 -0
- package/skills/android-play-policy-insights/scripts/template_engine.py +243 -0
- package/skills/android-profiler/SKILL.md +60 -0
- package/skills/android-profiler/analysis/analysis_orchestrator.md +32 -0
- package/skills/android-profiler/analysis/workflows/perfetto-sql/perfetto_sql.md +28 -0
- package/skills/android-profiler/analysis/workflows/perfetto-trace-analysis/perfetto_trace_analysis.md +121 -0
- package/skills/android-profiler/analysis/workflows/perfetto-trace-analysis/references/guiding_principles.md +51 -0
- package/skills/android-profiler/analysis/workflows/perfetto-trace-analysis/references/hints/domain_hints_template.md +7 -0
- package/skills/android-profiler/analysis/workflows/perfetto-trace-analysis/references/hints/subsystems/hints_cpu.md +56 -0
- package/skills/android-profiler/analysis/workflows/perfetto-trace-analysis/references/hints/subsystems/hints_graphics.md +51 -0
- package/skills/android-profiler/analysis/workflows/perfetto-trace-analysis/references/hints/subsystems/hints_io.md +46 -0
- package/skills/android-profiler/analysis/workflows/perfetto-trace-analysis/references/hints/subsystems/hints_ipc.md +41 -0
- package/skills/android-profiler/analysis/workflows/perfetto-trace-analysis/references/hints/subsystems/hints_memory.md +55 -0
- package/skills/android-profiler/analysis/workflows/perfetto-trace-analysis/references/hints/subsystems/hints_power.md +33 -0
- package/skills/android-profiler/analysis/workflows/perfetto-trace-analysis/references/per_candidate_analysis.md +172 -0
- package/skills/android-profiler/analysis/workflows/perfetto-trace-analysis/references/triage.md +94 -0
- package/skills/android-profiler/recording/recording_orchestrator.md +36 -0
- package/skills/android-profiler/recording/workflows/perfetto-trace-recording/perfetto_trace_recording.md +148 -0
- package/skills/android-profiler/recording/workflows/perfetto-trace-recording/references/example-configs/app_jank.pftxt +43 -0
- package/skills/android-profiler/recording/workflows/perfetto-trace-recording/references/example-configs/cpu_profile.pftxt +35 -0
- package/skills/android-profiler/recording/workflows/perfetto-trace-recording/references/example-configs/java_heap_dump.pftxt +21 -0
- package/skills/android-profiler/recording/workflows/perfetto-trace-recording/references/example-configs/long_background.pftxt +37 -0
- package/skills/android-profiler/recording/workflows/perfetto-trace-recording/references/example-configs/memory_counters.pftxt +45 -0
- package/skills/android-profiler/recording/workflows/perfetto-trace-recording/references/example-configs/native_heap.pftxt +21 -0
- package/skills/android-profiler/recording/workflows/perfetto-trace-recording/references/example-configs/sched_cpu.pftxt +33 -0
- package/skills/android-profiler/recording/workflows/perfetto-trace-recording/references/trace_config_reference.md +102 -0
- package/skills/android-profiler/references/env_setup.md +15 -0
- package/skills/android-profiler/references/perfetto/setup.md +29 -0
- package/skills/android-profiler/references/perfetto/sql.md +327 -0
- package/skills/android-r8-analyzer/SKILL.md +72 -0
- package/skills/android-r8-analyzer/references/CONFIGURATION-ANALYZER.md +287 -0
- package/skills/android-r8-analyzer/references/CONFIGURATION.md +44 -0
- package/skills/android-r8-analyzer/references/KEEP-RULES-IMPACT-HIERARCHY.md +83 -0
- package/skills/android-r8-analyzer/references/REDUNDANT-RULES.md +222 -0
- package/skills/android-r8-analyzer/references/REFLECTION-GUIDE.md +139 -0
- package/skills/android-r8-analyzer/references/REPORT_FORMAT.md +51 -0
- package/skills/android-r8-analyzer/references/android/topic/performance/app-optimization/enable-app-optimization.md +252 -0
- package/skills/android-r8-analyzer/references/android/training/testing/other-components/ui-automator.md +312 -0
- package/skills/android-restore-credentials/SKILL.md +359 -0
- package/skills/android-restore-credentials/references/android/guide/topics/manifest/application-element.md +832 -0
- package/skills/android-restore-credentials/references/android/identity/passkeys/create-passkeys.md +327 -0
- package/skills/android-restore-credentials/references/android/identity/passkeys/sign-in-with-passkeys.md +219 -0
- package/skills/android-styles/SKILL.md +229 -0
- package/skills/android-styles/references/android/develop/ui/compose/designsystems/custom.md +459 -0
- package/skills/android-styles/references/android/develop/ui/compose/styles/fundamentals.md +421 -0
- package/skills/android-styles/references/android/develop/ui/compose/styles/state-animations.md +461 -0
- package/skills/android-styles/references/android/develop/ui/compose/styles/styles-vs-modifiers.md +48 -0
- package/skills/android-styles/references/android/develop/ui/compose/styles/theming.md +269 -0
- package/skills/android-verified-email/SKILL.md +432 -0
- package/skills/android-verified-email/references/android/identity/credential-manager/index.md +67 -0
- package/skills/android-verified-email/references/android/identity/digital-credentials/credential-verifier.md +166 -0
- package/skills/android-verified-email/references/android/identity/digital-credentials/email-verification-implementation.md +313 -0
- package/skills/android-verified-email/references/android/identity/digital-credentials/email-verification.md +158 -0
- package/skills/android-verified-email/references/android/identity/digital-credentials/index.md +112 -0
- package/skills/android-verified-email/references/android/identity/passkeys/create-passkeys.md +327 -0
- package/skills/android-verified-email/references/android/identity/sign-in/credential-manager-webview.md +84 -0
- package/skills/android-wear-compose-m3/SKILL.md +365 -0
- package/skills/android-wear-compose-m3/references/android/training/wearables/compose/migrate-to-material3.md +677 -0
- package/skills/android-wear-compose-m3/references/foundation/AmbientModeSample.kt.md +123 -0
- package/skills/android-wear-compose-m3/references/foundation/AmbientModeSample.kt.md.txt +123 -0
- package/skills/android-wear-compose-m3/references/foundation/CurvedWorldSample.kt.md +430 -0
- package/skills/android-wear-compose-m3/references/foundation/CurvedWorldSample.kt.md.txt +430 -0
- package/skills/android-wear-compose-m3/references/foundation/ExpandableSample.kt.md +99 -0
- package/skills/android-wear-compose-m3/references/foundation/ExpandableSample.kt.md.txt +99 -0
- package/skills/android-wear-compose-m3/references/foundation/HierarchicalFocusSample.kt.md +141 -0
- package/skills/android-wear-compose-m3/references/foundation/HierarchicalFocusSample.kt.md.txt +141 -0
- package/skills/android-wear-compose-m3/references/foundation/PagerSamples.kt.md +56 -0
- package/skills/android-wear-compose-m3/references/foundation/PagerSamples.kt.md.txt +56 -0
- package/skills/android-wear-compose-m3/references/foundation/RotarySamples.kt.md +153 -0
- package/skills/android-wear-compose-m3/references/foundation/RotarySamples.kt.md.txt +153 -0
- package/skills/android-wear-compose-m3/references/foundation/ScalingLazyColumnSample.kt.md +131 -0
- package/skills/android-wear-compose-m3/references/foundation/ScalingLazyColumnSample.kt.md.txt +131 -0
- package/skills/android-wear-compose-m3/references/foundation/SwipeToDismissBoxSample.kt.md +169 -0
- package/skills/android-wear-compose-m3/references/foundation/SwipeToDismissBoxSample.kt.md.txt +169 -0
- package/skills/android-wear-compose-m3/references/foundation/SwipeToRevealSample.kt.md +282 -0
- package/skills/android-wear-compose-m3/references/foundation/SwipeToRevealSample.kt.md.txt +282 -0
- package/skills/android-wear-compose-m3/references/foundation/TransformingLazyColumnSample.kt.md +335 -0
- package/skills/android-wear-compose-m3/references/foundation/TransformingLazyColumnSample.kt.md.txt +335 -0
- package/skills/android-wear-compose-m3/references/material3/AlertDialogSample.kt.md +377 -0
- package/skills/android-wear-compose-m3/references/material3/AlertDialogSample.kt.md.txt +377 -0
- package/skills/android-wear-compose-m3/references/material3/AnimatedTextSample.kt.md +165 -0
- package/skills/android-wear-compose-m3/references/material3/AnimatedTextSample.kt.md.txt +165 -0
- package/skills/android-wear-compose-m3/references/material3/ButtonGroupSample.kt.md +91 -0
- package/skills/android-wear-compose-m3/references/material3/ButtonGroupSample.kt.md.txt +91 -0
- package/skills/android-wear-compose-m3/references/material3/ButtonSample.kt.md +496 -0
- package/skills/android-wear-compose-m3/references/material3/ButtonSample.kt.md.txt +496 -0
- package/skills/android-wear-compose-m3/references/material3/CardSample.kt.md +470 -0
- package/skills/android-wear-compose-m3/references/material3/CardSample.kt.md.txt +470 -0
- package/skills/android-wear-compose-m3/references/material3/CheckboxButtonSample.kt.md +67 -0
- package/skills/android-wear-compose-m3/references/material3/CheckboxButtonSample.kt.md.txt +67 -0
- package/skills/android-wear-compose-m3/references/material3/ConfirmationDialogSample.kt.md +162 -0
- package/skills/android-wear-compose-m3/references/material3/ConfirmationDialogSample.kt.md.txt +162 -0
- package/skills/android-wear-compose-m3/references/material3/CurvedTextSamples.kt.md +78 -0
- package/skills/android-wear-compose-m3/references/material3/CurvedTextSamples.kt.md.txt +78 -0
- package/skills/android-wear-compose-m3/references/material3/DatePickerSample.kt.md +131 -0
- package/skills/android-wear-compose-m3/references/material3/DatePickerSample.kt.md.txt +131 -0
- package/skills/android-wear-compose-m3/references/material3/DynamicColorSchemeSample.kt.md +74 -0
- package/skills/android-wear-compose-m3/references/material3/DynamicColorSchemeSample.kt.md.txt +74 -0
- package/skills/android-wear-compose-m3/references/material3/EdgeButtonSample.kt.md +63 -0
- package/skills/android-wear-compose-m3/references/material3/EdgeButtonSample.kt.md.txt +63 -0
- package/skills/android-wear-compose-m3/references/material3/FadingExpandingLabelSample.kt.md +60 -0
- package/skills/android-wear-compose-m3/references/material3/FadingExpandingLabelSample.kt.md.txt +60 -0
- package/skills/android-wear-compose-m3/references/material3/IconButtonSample.kt.md +125 -0
- package/skills/android-wear-compose-m3/references/material3/IconButtonSample.kt.md.txt +125 -0
- package/skills/android-wear-compose-m3/references/material3/IconToggleButtonSample.kt.md +116 -0
- package/skills/android-wear-compose-m3/references/material3/IconToggleButtonSample.kt.md.txt +116 -0
- package/skills/android-wear-compose-m3/references/material3/LevelIndicatorSample.kt.md +68 -0
- package/skills/android-wear-compose-m3/references/material3/LevelIndicatorSample.kt.md.txt +68 -0
- package/skills/android-wear-compose-m3/references/material3/LinearProgressIndicatorSample.kt.md +50 -0
- package/skills/android-wear-compose-m3/references/material3/LinearProgressIndicatorSample.kt.md.txt +50 -0
- package/skills/android-wear-compose-m3/references/material3/ListHeaderSample.kt.md +177 -0
- package/skills/android-wear-compose-m3/references/material3/ListHeaderSample.kt.md.txt +177 -0
- package/skills/android-wear-compose-m3/references/material3/OneHandedGestureSamples.kt.md +651 -0
- package/skills/android-wear-compose-m3/references/material3/OneHandedGestureSamples.kt.md.txt +651 -0
- package/skills/android-wear-compose-m3/references/material3/OpenOnPhoneDialogSample.kt.md +57 -0
- package/skills/android-wear-compose-m3/references/material3/OpenOnPhoneDialogSample.kt.md.txt +57 -0
- package/skills/android-wear-compose-m3/references/material3/PageIndicatorSample.kt.md +110 -0
- package/skills/android-wear-compose-m3/references/material3/PageIndicatorSample.kt.md.txt +110 -0
- package/skills/android-wear-compose-m3/references/material3/PagerScaffoldSample.kt.md +204 -0
- package/skills/android-wear-compose-m3/references/material3/PagerScaffoldSample.kt.md.txt +204 -0
- package/skills/android-wear-compose-m3/references/material3/PickerGroupSample.kt.md +139 -0
- package/skills/android-wear-compose-m3/references/material3/PickerGroupSample.kt.md.txt +139 -0
- package/skills/android-wear-compose-m3/references/material3/PickerSample.kt.md +111 -0
- package/skills/android-wear-compose-m3/references/material3/PickerSample.kt.md.txt +111 -0
- package/skills/android-wear-compose-m3/references/material3/PlaceholderSample.kt.md +184 -0
- package/skills/android-wear-compose-m3/references/material3/PlaceholderSample.kt.md.txt +184 -0
- package/skills/android-wear-compose-m3/references/material3/ProgressIndicatorSample.kt.md +263 -0
- package/skills/android-wear-compose-m3/references/material3/ProgressIndicatorSample.kt.md.txt +263 -0
- package/skills/android-wear-compose-m3/references/material3/RadioButtonSample.kt.md +105 -0
- package/skills/android-wear-compose-m3/references/material3/RadioButtonSample.kt.md.txt +105 -0
- package/skills/android-wear-compose-m3/references/material3/ScaffoldSample.kt.md +146 -0
- package/skills/android-wear-compose-m3/references/material3/ScaffoldSample.kt.md.txt +146 -0
- package/skills/android-wear-compose-m3/references/material3/ScrollAwaySample.kt.md +97 -0
- package/skills/android-wear-compose-m3/references/material3/ScrollAwaySample.kt.md.txt +97 -0
- package/skills/android-wear-compose-m3/references/material3/ScrollIndicatorSample.kt.md +66 -0
- package/skills/android-wear-compose-m3/references/material3/ScrollIndicatorSample.kt.md.txt +66 -0
- package/skills/android-wear-compose-m3/references/material3/SliderSample.kt.md +86 -0
- package/skills/android-wear-compose-m3/references/material3/SliderSample.kt.md.txt +86 -0
- package/skills/android-wear-compose-m3/references/material3/StepperSample.kt.md +148 -0
- package/skills/android-wear-compose-m3/references/material3/StepperSample.kt.md.txt +148 -0
- package/skills/android-wear-compose-m3/references/material3/SurfaceTransformationSample.kt.md +166 -0
- package/skills/android-wear-compose-m3/references/material3/SurfaceTransformationSample.kt.md.txt +166 -0
- package/skills/android-wear-compose-m3/references/material3/SwipeToDismissBoxSample.kt.md +172 -0
- package/skills/android-wear-compose-m3/references/material3/SwipeToDismissBoxSample.kt.md.txt +172 -0
- package/skills/android-wear-compose-m3/references/material3/SwipeToRevealSample.kt.md +367 -0
- package/skills/android-wear-compose-m3/references/material3/SwipeToRevealSample.kt.md.txt +367 -0
- package/skills/android-wear-compose-m3/references/material3/SwitchButtonSample.kt.md +66 -0
- package/skills/android-wear-compose-m3/references/material3/SwitchButtonSample.kt.md.txt +66 -0
- package/skills/android-wear-compose-m3/references/material3/TextButtonSample.kt.md +115 -0
- package/skills/android-wear-compose-m3/references/material3/TextButtonSample.kt.md.txt +115 -0
- package/skills/android-wear-compose-m3/references/material3/TextToggleButtonSample.kt.md +71 -0
- package/skills/android-wear-compose-m3/references/material3/TextToggleButtonSample.kt.md.txt +71 -0
- package/skills/android-wear-compose-m3/references/material3/TimePickerSample.kt.md +151 -0
- package/skills/android-wear-compose-m3/references/material3/TimePickerSample.kt.md.txt +151 -0
- package/skills/android-wear-compose-m3/references/material3/TimeTextSample.kt.md +65 -0
- package/skills/android-wear-compose-m3/references/material3/TimeTextSample.kt.md.txt +65 -0
- package/skills/android-wear-compose-m3/references/material3/TransformationSpecSample.kt.md +246 -0
- package/skills/android-wear-compose-m3/references/material3/TransformationSpecSample.kt.md.txt +246 -0
- package/skills/android-wear-compose-m3/references/material3/TransformingLazyColumnNotificationsSample.kt.md +89 -0
- package/skills/android-wear-compose-m3/references/material3/TransformingLazyColumnNotificationsSample.kt.md.txt +89 -0
- package/skills/android-wear-compose-m3/references/material3/TransformingLazyColumnSample.kt.md +309 -0
- package/skills/android-wear-compose-m3/references/material3/TransformingLazyColumnSample.kt.md.txt +309 -0
- package/skills/android-wear-compose-m3/references/navigation3/SwipeDismissableSceneStrategySample.kt.md +205 -0
- package/skills/android-wear-compose-m3/references/navigation3/SwipeDismissableSceneStrategySample.kt.md.txt +205 -0
- package/skills/{architecture-feature-first → flutter-architecture-feature-first}/SKILL.md +1 -1
- package/skills/{bloc → flutter-bloc}/SKILL.md +1 -1
- package/skills/flutter-build-debug/SKILL.md +66 -0
- package/skills/{code-review → flutter-code-review}/SKILL.md +1 -1
- package/skills/{dart-3-updates → flutter-dart-3-updates}/SKILL.md +1 -1
- package/skills/{dart-fix-runtime-errors → flutter-dart-fix-runtime-errors}/SKILL.md +1 -1
- package/skills/{dart-resolve-package-conflicts → flutter-dart-resolve-package-conflicts}/SKILL.md +1 -1
- package/skills/{dart-run-static-analysis → flutter-dart-run-static-analysis}/SKILL.md +1 -1
- package/skills/{dart-use-pattern-matching → flutter-dart-use-pattern-matching}/SKILL.md +1 -1
- package/skills/{effective-dart → flutter-effective-dart}/SKILL.md +1 -1
- package/skills/{provider → flutter-provider}/SKILL.md +1 -1
- package/skills/{riverpod → flutter-riverpod}/SKILL.md +1 -1
- package/skills/ios-cocoapods-debug/SKILL.md +65 -0
- package/skills/ios-code-review/SKILL.md +56 -0
- package/skills/ios-xcode-build-debug/SKILL.md +66 -0
- package/skills/{detect-mobile-stack → mobile-detect-stack}/SKILL.md +1 -1
- package/skills/mobile-firebase/SKILL.md +54 -0
- package/skills/mobile-firebase/references/android/ai-logic.md +31 -0
- package/skills/mobile-firebase/references/android/analytics.md +33 -0
- package/skills/mobile-firebase/references/android/app-check.md +36 -0
- package/skills/mobile-firebase/references/android/auth.md +44 -0
- package/skills/mobile-firebase/references/android/crashlytics.md +31 -0
- package/skills/mobile-firebase/references/android/firestore.md +44 -0
- package/skills/mobile-firebase/references/android/functions.md +33 -0
- package/skills/mobile-firebase/references/android/in-app-messaging.md +28 -0
- package/skills/mobile-firebase/references/android/messaging.md +41 -0
- package/skills/mobile-firebase/references/android/realtime-database.md +50 -0
- package/skills/mobile-firebase/references/android/remote-config.md +43 -0
- package/skills/mobile-firebase/references/android/sql-connect.md +31 -0
- package/skills/mobile-firebase/references/android/storage.md +39 -0
- package/skills/mobile-firebase/references/android.md +30 -0
- package/skills/{firebase-ai/SKILL.md → mobile-firebase/references/flutter/ai-logic.md} +2 -8
- package/skills/{firebase-analytics/SKILL.md → mobile-firebase/references/flutter/analytics.md} +2 -8
- package/skills/{firebase-app-check/SKILL.md → mobile-firebase/references/flutter/app-check.md} +2 -8
- package/skills/{firebase-auth/SKILL.md → mobile-firebase/references/flutter/auth.md} +2 -8
- package/skills/{firebase-crashlytics/SKILL.md → mobile-firebase/references/flutter/crashlytics.md} +2 -8
- package/skills/{firebase-cloud-firestore/SKILL.md → mobile-firebase/references/flutter/firestore.md} +2 -8
- package/skills/{firebase-cloud-functions/SKILL.md → mobile-firebase/references/flutter/functions.md} +2 -8
- package/skills/{firebase-in-app-messaging/SKILL.md → mobile-firebase/references/flutter/in-app-messaging.md} +2 -8
- package/skills/{firebase-messaging/SKILL.md → mobile-firebase/references/flutter/messaging.md} +2 -8
- package/skills/{firebase-database/SKILL.md → mobile-firebase/references/flutter/realtime-database.md} +2 -8
- package/skills/{firebase-remote-config/SKILL.md → mobile-firebase/references/flutter/remote-config.md} +2 -8
- package/skills/{flutterfire-configure/SKILL.md → mobile-firebase/references/flutter/setup-flutterfire.md} +1 -8
- package/skills/{firebase-data-connect/SKILL.md → mobile-firebase/references/flutter/sql-connect.md} +2 -8
- package/skills/{firebase-storage/SKILL.md → mobile-firebase/references/flutter/storage.md} +2 -8
- package/skills/mobile-firebase/references/flutter.md +36 -0
- package/skills/mobile-firebase/references/ios/ai-logic.md +30 -0
- package/skills/mobile-firebase/references/ios/analytics.md +33 -0
- package/skills/mobile-firebase/references/ios/app-check.md +36 -0
- package/skills/mobile-firebase/references/ios/auth.md +48 -0
- package/skills/mobile-firebase/references/ios/crashlytics.md +34 -0
- package/skills/mobile-firebase/references/ios/firestore.md +53 -0
- package/skills/mobile-firebase/references/ios/functions.md +35 -0
- package/skills/mobile-firebase/references/ios/in-app-messaging.md +26 -0
- package/skills/mobile-firebase/references/ios/messaging.md +45 -0
- package/skills/mobile-firebase/references/ios/realtime-database.md +49 -0
- package/skills/mobile-firebase/references/ios/remote-config.md +44 -0
- package/skills/mobile-firebase/references/ios/sql-connect.md +33 -0
- package/skills/mobile-firebase/references/ios/storage.md +36 -0
- package/skills/mobile-firebase/references/ios.md +28 -0
- package/skills/mobile-firebase/references/react-native/ai-logic.md +32 -0
- package/skills/mobile-firebase/references/react-native/analytics.md +43 -0
- package/skills/mobile-firebase/references/react-native/app-check.md +35 -0
- package/skills/mobile-firebase/references/react-native/auth.md +50 -0
- package/skills/mobile-firebase/references/react-native/crashlytics.md +36 -0
- package/skills/mobile-firebase/references/react-native/firestore.md +45 -0
- package/skills/mobile-firebase/references/react-native/functions.md +28 -0
- package/skills/mobile-firebase/references/react-native/in-app-messaging.md +27 -0
- package/skills/mobile-firebase/references/react-native/messaging.md +46 -0
- package/skills/mobile-firebase/references/react-native/realtime-database.md +46 -0
- package/skills/mobile-firebase/references/react-native/remote-config.md +32 -0
- package/skills/mobile-firebase/references/react-native/sql-connect.md +11 -0
- package/skills/mobile-firebase/references/react-native/storage.md +30 -0
- package/skills/mobile-firebase/references/react-native.md +29 -0
- package/skills/mobile-test/SKILL.md +63 -0
- package/skills/mobile-test/references/android/setup/GUIDE.md +183 -0
- package/skills/mobile-test/references/android/setup/references/android/develop/ui/compose/testing/common-patterns.md +181 -0
- package/skills/mobile-test/references/android/setup/references/android/studio/preview/compose-screenshot-testing.md +255 -0
- package/skills/mobile-test/references/android/setup/references/android/training/dependency-injection/hilt-testing.md +447 -0
- package/skills/mobile-test/references/android.md +83 -0
- package/skills/{dart-collect-coverage/SKILL.md → mobile-test/references/flutter/coverage.md} +2 -11
- package/skills/{dart-generate-test-mocks/SKILL.md → mobile-test/references/flutter/generate-mocks.md} +2 -11
- package/skills/{flutter-add-integration-test/SKILL.md → mobile-test/references/flutter/integration-tests.md} +2 -11
- package/skills/{dart-migrate-to-checks-package/SKILL.md → mobile-test/references/flutter/migrate-to-checks.md} +2 -13
- package/skills/{mockito/SKILL.md → mobile-test/references/flutter/mockito.md} +1 -8
- package/skills/{mocktail/SKILL.md → mobile-test/references/flutter/mocktail.md} +1 -8
- package/skills/{patrol-e2e-testing/SKILL.md → mobile-test/references/flutter/patrol.md} +1 -8
- package/skills/{testing/SKILL.md → mobile-test/references/flutter/testing-guidelines.md} +1 -8
- package/skills/{dart-add-unit-test/SKILL.md → mobile-test/references/flutter/unit-tests.md} +2 -11
- package/skills/{flutter-add-widget-test/SKILL.md → mobile-test/references/flutter/widget-tests.md} +2 -11
- package/skills/mobile-test/references/flutter.md +44 -0
- package/skills/mobile-test/references/ios.md +79 -0
- package/skills/mobile-test/references/react-native.md +62 -0
- /package/skills/{dart-use-pattern-matching → flutter-dart-use-pattern-matching}/examples/json_patterns.dart +0 -0
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
This document outlines common "bad" or redundant keep rules for standard Android
|
|
2
|
+
development and popular libraries. Modern toolchains and libraries include their
|
|
3
|
+
own consumer keep rules embedded in their AAR/JAR files, making many manual
|
|
4
|
+
configurations unnecessary or even harmful to code optimization.
|
|
5
|
+
|
|
6
|
+
*** ** * ** ***
|
|
7
|
+
|
|
8
|
+
## Case: Global Keep Rules
|
|
9
|
+
|
|
10
|
+
**Common Mistakes:**
|
|
11
|
+
`proguard
|
|
12
|
+
-dontshrink
|
|
13
|
+
-dontobfuscate
|
|
14
|
+
-dontoptimize`
|
|
15
|
+
|
|
16
|
+
**The Fix:** These keep rules completely disable the core optimizations of R8
|
|
17
|
+
for the entire codebase. They must be removed from the codebase.
|
|
18
|
+
|
|
19
|
+
*** ** * ** ***
|
|
20
|
+
|
|
21
|
+
## Case: Android Components
|
|
22
|
+
|
|
23
|
+
Keep rules required for Android components like Activity, Fragment, ViewModel,
|
|
24
|
+
Views, Services or Broadcast receivers are redundant. AAPT2 and R8 contain the
|
|
25
|
+
logic to automatically keep components declared in the `AndroidManifest.xml` or
|
|
26
|
+
referenced in XML layout files.
|
|
27
|
+
|
|
28
|
+
**Common Mistakes:**
|
|
29
|
+
`proguard
|
|
30
|
+
-keep public class * extends android.app.Activity
|
|
31
|
+
-keep public class * extends android.app.Service
|
|
32
|
+
-keep public class * extends android.view.View
|
|
33
|
+
-keepclassmembers class * extends android.app.Fragment { public void *(android.view.View); }`
|
|
34
|
+
|
|
35
|
+
**The Fix:** Delete these manual rules. AAPT2 handles this automatically.
|
|
36
|
+
|
|
37
|
+
*** ** * ** ***
|
|
38
|
+
|
|
39
|
+
## Case: Official Android and Kotlin Libraries
|
|
40
|
+
|
|
41
|
+
Keep rules targeting official library packages like AndroidX, Kotlin, and
|
|
42
|
+
Kotlinx are redundant as they are bundled within the libraries themselves.
|
|
43
|
+
Manual rules are often broader than what is strictly needed.
|
|
44
|
+
|
|
45
|
+
**Common Mistakes:**
|
|
46
|
+
`proguard
|
|
47
|
+
-keep class androidx.** { *; }
|
|
48
|
+
-keep class kotlinx.** { *; }
|
|
49
|
+
-keep class kotlin.** { *; }`
|
|
50
|
+
|
|
51
|
+
**The Fix:** Delete these manual rules. Rely on the consumer keep rules packaged
|
|
52
|
+
within these dependencies.
|
|
53
|
+
|
|
54
|
+
*** ** * ** ***
|
|
55
|
+
|
|
56
|
+
## Case: Gson
|
|
57
|
+
|
|
58
|
+
### Overly Broad Data Model Rules
|
|
59
|
+
|
|
60
|
+
The most common mistake is keeping entire packages of data models (POJOs/DTOs),
|
|
61
|
+
keeping data models at all for deserialization is unnecessary.
|
|
62
|
+
|
|
63
|
+
-keep class com.example.app.models.** { *; }
|
|
64
|
+
-keep class com.example.app.package.models.* { *; }
|
|
65
|
+
|
|
66
|
+
### Redundant Interface \& Adapter Rules
|
|
67
|
+
|
|
68
|
+
These rules added for TypeAdapter are unnecessary and are already covered by
|
|
69
|
+
the library, and prevent R8 from effectively shrinking and optimizing custom
|
|
70
|
+
adapters. R8 can determine if the adapter implementation are used. Keeping them
|
|
71
|
+
globally prevents the removal of unused adapter implementations.
|
|
72
|
+
|
|
73
|
+
-keep class * extends com.google.gson.TypeAdapter
|
|
74
|
+
-keep class * implements com.google.gson.TypeAdapterFactory
|
|
75
|
+
-keep class * implements com.google.gson.JsonSerializer
|
|
76
|
+
-keep class * implements com.google.gson.JsonDeserializer
|
|
77
|
+
|
|
78
|
+
### Unnecessary TypeToken Rules
|
|
79
|
+
|
|
80
|
+
There is no need to handle generic type erasure, Gson's own rules handle the
|
|
81
|
+
necessary `TypeToken` preservation.
|
|
82
|
+
|
|
83
|
+
-keep class com.google.gson.reflect.TypeToken { *; }
|
|
84
|
+
-keep class * extends com.google.gson.reflect.TypeToken
|
|
85
|
+
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
|
|
86
|
+
|
|
87
|
+
### Internal and Example Packages
|
|
88
|
+
|
|
89
|
+
Keeping internal library logic prevents the compiler from stripping away dead
|
|
90
|
+
code within the library.
|
|
91
|
+
|
|
92
|
+
-keep class com.google.gson.internal.** { *; }
|
|
93
|
+
-keep class com.google.gson.internal.reflect.** { *; }
|
|
94
|
+
-keep class com.google.gson.internal.UnsafeAllocator { *; }
|
|
95
|
+
-keep class com.google.gson.stream.** { *; }
|
|
96
|
+
|
|
97
|
+
- **Keeps Unused Code:** Prevents R8 from removing models that are never actually used in the code.
|
|
98
|
+
- **Prevents Method Stripping:** Keeps all getters, setters, `toString()`, `equals()`, and `hashCode()` methods, even if they are never called.
|
|
99
|
+
- **Blocks Obfuscation:** Prevents the class names from being obfuscated, which is unnecessary for Gson if you use `@SerializedName`.
|
|
100
|
+
|
|
101
|
+
**The Fix:**
|
|
102
|
+
|
|
103
|
+
1. Use `@SerializedName` on every field in your data classes uses so that the field is retained after R8 optimization
|
|
104
|
+
2. Modern Gson (**v2.11.0+** ) bundles its own rules ([View Gson's embedded
|
|
105
|
+
ProGuard
|
|
106
|
+
rules](https://github.com/google/gson/blob/main/gson/src/main/resources/META-INF/proguard/gson.pro)). The bundled keep rules retains the `@SerializedName` annotated fields. If you are on an older version, move towards Gson version 2.11 because it has the necessary keep rules and delete the keep rules that target the classes used for gson serialization and deserialization
|
|
107
|
+
|
|
108
|
+
*** ** * ** ***
|
|
109
|
+
|
|
110
|
+
## Case: Retrofit
|
|
111
|
+
|
|
112
|
+
Retrofit has shipped with its own consumer keep rules from 2.9.0 and higher, so
|
|
113
|
+
any keep rules for the library or classes depending on Retrofit is detrimental
|
|
114
|
+
to the optimization process.
|
|
115
|
+
|
|
116
|
+
### Blanket Library Preservation
|
|
117
|
+
|
|
118
|
+
This is the most harmful Retrofit rule as it disables any shrinking for the
|
|
119
|
+
entire library.
|
|
120
|
+
|
|
121
|
+
-keep class retrofit2.** { *; }
|
|
122
|
+
-keep class retrofit2.api.** { *; }
|
|
123
|
+
-keep class com.package.example.retrofit.api.** { *; }
|
|
124
|
+
|
|
125
|
+
### Manual Annotation Keeps
|
|
126
|
+
|
|
127
|
+
Retrofit's consumer rules automatically keep the interfaces annotated with
|
|
128
|
+
`@GET`, `@POST`, `@DELETE`, `@PUT`, `@HEAD`, `@OPTIONS`, `@PATCH`, making these
|
|
129
|
+
manual rules obsolete.
|
|
130
|
+
|
|
131
|
+
`-keepclasseswithmembers class * { @retrofit2.http.* <methods>; }`
|
|
132
|
+
|
|
133
|
+
### Redundant Network Response and Adapter Rules
|
|
134
|
+
|
|
135
|
+
Network responses and third-party adapter wrappers (like RxJava) are often
|
|
136
|
+
overly preserved by developers out of caution.
|
|
137
|
+
|
|
138
|
+
-keep,allowobfuscation,allowshrinking class retrofit2.Response
|
|
139
|
+
-keep class retrofit2.adapter.rxjava2.Result { *; }
|
|
140
|
+
|
|
141
|
+
Fix: Verify you are using Retrofit 2.9.0 and higher. Retrofit from 2.9.0 bundles
|
|
142
|
+
rules that detect its own HTTP annotations (@GET, @POST) ([View Retrofit's
|
|
143
|
+
embedded ProGuard
|
|
144
|
+
rules](https://github.com/square/retrofit/blob/master/retrofit/src/main/resources/META-INF/proguard/retrofit2.pro)).
|
|
145
|
+
It will automatically keep the method signatures it needs to work.
|
|
146
|
+
|
|
147
|
+
*** ** * ** ***
|
|
148
|
+
|
|
149
|
+
## Case: Kotlin Coroutines
|
|
150
|
+
|
|
151
|
+
Kotlin Coroutines comes heavily optimized out of the box with embedded R8 rules
|
|
152
|
+
(`kotlinx-coroutines-core` includes its own rules).
|
|
153
|
+
|
|
154
|
+
### Blanket Coroutine Library Rules
|
|
155
|
+
|
|
156
|
+
Keeping everything under `kotlinx.coroutines` is extremely detrimental to app
|
|
157
|
+
size, as coroutines contain a vast amount of internal APIs that aren't used.
|
|
158
|
+
|
|
159
|
+
`-keepclassmembers class kotlinx.coroutines.** { *; }`
|
|
160
|
+
|
|
161
|
+
### Redundant Internal Continuations
|
|
162
|
+
|
|
163
|
+
These low-level coroutine elements are preserved safely by the library's own
|
|
164
|
+
consumer rules. Manually adding these prevents R8 from performing internal
|
|
165
|
+
optimizations (such as removing unused continuations or inlining).
|
|
166
|
+
|
|
167
|
+
-keepclassmembers class kotlin.coroutines.SafeContinuation { *; }
|
|
168
|
+
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation
|
|
169
|
+
|
|
170
|
+
### Dispatcher and Exception Handler Rules
|
|
171
|
+
|
|
172
|
+
Sometimes developers notice crashes related to Missing Classes on old Android
|
|
173
|
+
versions and add these rules, but if you are using an up-to-date version of
|
|
174
|
+
Coroutines, these are handled automatically or are not an issue.
|
|
175
|
+
|
|
176
|
+
-keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {}
|
|
177
|
+
-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}
|
|
178
|
+
-keepnames class kotlinx.coroutines.android.AndroidExceptionPreHandler {}
|
|
179
|
+
-keepnames class kotlinx.coroutines.android.AndroidDispatcherFactory {}
|
|
180
|
+
|
|
181
|
+
**Fix** Remove any broad `kotlinx` keep rules. Coroutines (**v1.7.0+** ) bundle
|
|
182
|
+
the necessary keep rules ([View Coroutines' embedded ProGuard
|
|
183
|
+
rules](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/resources/META-INF/proguard/coroutines.pro)).
|
|
184
|
+
|
|
185
|
+
*** ** * ** ***
|
|
186
|
+
|
|
187
|
+
## Case: Parcelable
|
|
188
|
+
|
|
189
|
+
**Common Mistakes:** Legacy projects often contain `-keep class * implements
|
|
190
|
+
android.os.Parcelable { public static final android.os.Parcelable$Creator *; }`.
|
|
191
|
+
|
|
192
|
+
**The Fix:**
|
|
193
|
+
|
|
194
|
+
1. Add the `kotlin-parcelize` plugin.
|
|
195
|
+
2. **Use `@Parcelize`:** Replace manual `writeToParcel` logic with the `@Parcelize` annotation.
|
|
196
|
+
3. **Delete All Parcelable Rules:** The plugin automatically generates the required rules.
|
|
197
|
+
4. The default proguard file `proguard-android-optimize.txt` contains the keep rules for keeping all the parcelable classes
|
|
198
|
+
5. **Ideal Rule:** **None.** Delete all manual Parcelable keeps.
|
|
199
|
+
|
|
200
|
+
*** ** * ** ***
|
|
201
|
+
|
|
202
|
+
## Case: Room Database
|
|
203
|
+
|
|
204
|
+
**Common Mistakes:** Keeping DAO interfaces or the generated `_Impl` classes
|
|
205
|
+
manually.
|
|
206
|
+
|
|
207
|
+
-keep class * extends androidx.room.RoomDatabase
|
|
208
|
+
-keep class *_*Impl { *; }
|
|
209
|
+
|
|
210
|
+
**The Fix:** Room generates its own ProGuard rules for the code it creates.
|
|
211
|
+
Manual rules are redundant and prevent R8 from optimizing the database access
|
|
212
|
+
layers.
|
|
213
|
+
|
|
214
|
+
- **Ideal Rule:** **None.** Delete all manual Room or DAO keeps.
|
|
215
|
+
|
|
216
|
+
*** ** * ** ***
|
|
217
|
+
|
|
218
|
+
## Summary
|
|
219
|
+
|
|
220
|
+
If you have updated your libraries to the versions mentioned, your
|
|
221
|
+
`proguard-rules.pro` must not contain any keep rules for the libraries
|
|
222
|
+
mentioned here.
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
A categorized summary of the keep rule examples, including the code patterns to
|
|
2
|
+
look for (imports/usage) and the corresponding suggested rules.
|
|
3
|
+
|
|
4
|
+
### 1. Reflection: Classes Loaded by Name
|
|
5
|
+
|
|
6
|
+
**Scenario:** A library or app loads a class dynamically using a string name
|
|
7
|
+
|
|
8
|
+
- **Look for:**
|
|
9
|
+
`Class.forName("...")`,
|
|
10
|
+
`getDeclaredConstructor().newInstance()`, or interfaces used for dynamic loading.
|
|
11
|
+
|
|
12
|
+
- **Example Code:**
|
|
13
|
+
`kotlin
|
|
14
|
+
val taskClass = Class.forName(className)
|
|
15
|
+
val task = taskClass.getDeclaredConstructor().newInstance() as StartupTask`
|
|
16
|
+
|
|
17
|
+
- **Suggested Keep Rule:**
|
|
18
|
+
\`\`\`proguard
|
|
19
|
+
|
|
20
|
+
-keep class \* implements com.example.library.StartupTask {
|
|
21
|
+
(); } \`\`\`
|
|
22
|
+
|
|
23
|
+
### 2. Reflection: Classes Passed using `::class.java`
|
|
24
|
+
|
|
25
|
+
**Scenario:** An app passes a class reference directly to a library function.
|
|
26
|
+
|
|
27
|
+
- **Look for:** `::class.java` (Kotlin) or `.class` (Java) passed as an argument.
|
|
28
|
+
- **Example Code:**
|
|
29
|
+
`kotlin
|
|
30
|
+
fun <T> register(clazz: Class<T>) { }
|
|
31
|
+
// Usage:
|
|
32
|
+
register(MyService::class.java)`
|
|
33
|
+
|
|
34
|
+
- **Suggested Keep Rule:**
|
|
35
|
+
\`\`\`proguard
|
|
36
|
+
|
|
37
|
+
# Keep the class itself (R8 usually handles this, but explicit rules ensure stability)
|
|
38
|
+
|
|
39
|
+
-keep class com.example.app.MyService {
|
|
40
|
+
(); } \`\`\`
|
|
41
|
+
|
|
42
|
+
### 3. Annotation-Based Reflection (Methods/Classes)
|
|
43
|
+
|
|
44
|
+
**Scenario:** Using custom annotations to mark methods or classes for reflective
|
|
45
|
+
execution.
|
|
46
|
+
|
|
47
|
+
**Look for:** Custom `@interface` definitions and `getDeclaredMethods()`
|
|
48
|
+
filtered by annotation.
|
|
49
|
+
**Example Code:**
|
|
50
|
+
`kotlin
|
|
51
|
+
annotation class ReflectiveExecutor
|
|
52
|
+
// Logic: find methods annotated with @ReflectiveExecutor and invoke them`
|
|
53
|
+
|
|
54
|
+
- **Suggested Keep Rule:** \`\`\`proguard # Keep the annotation itself -keep @interface com.example.library.ReflectiveExecutor
|
|
55
|
+
|
|
56
|
+
# Keep members of any class annotated with this specific annotation
|
|
57
|
+
-keepclassmembers class \* {
|
|
58
|
+
@com.example.library.ReflectiveExecutor \*;
|
|
59
|
+
}
|
|
60
|
+
\`\`\`
|
|
61
|
+
|
|
62
|
+
### 4. Optional Dependencies (Soft Dependencies)
|
|
63
|
+
|
|
64
|
+
**Scenario:** A core library checks if an optional module is present in the
|
|
65
|
+
classpath.
|
|
66
|
+
|
|
67
|
+
- **Look for:** `try-catch` blocks around `Class.forName()` used to toggle features.
|
|
68
|
+
- **Example Code:** \`\`\`kotlin private const val VIDEO_TRACKER_CLASS = "com.example.analytics.video.VideoEventTracker"
|
|
69
|
+
|
|
70
|
+
try {
|
|
71
|
+
Class.forName(VIDEO_TRACKER_CLASS).getDeclaredConstructor().newInstance()
|
|
72
|
+
} catch (e: ClassNotFoundException) { /\* skip feature \*/ }
|
|
73
|
+
\`\`\`
|
|
74
|
+
|
|
75
|
+
- **Suggested Keep Rule:** `proguard
|
|
76
|
+
# Preserve the optional class so the check doesn't fail due to shrinking
|
|
77
|
+
-keep class com.example.analytics.video.VideoEventTracker {
|
|
78
|
+
<init>();
|
|
79
|
+
}`
|
|
80
|
+
|
|
81
|
+
### 5. Accessing Private Members
|
|
82
|
+
|
|
83
|
+
**Scenario:** Using reflection to access internal fields or methods not exposed
|
|
84
|
+
with public APIs.
|
|
85
|
+
|
|
86
|
+
- **Look for:** `getDeclaredField("...")` or `getDeclaredMethod("...")` followed by `isAccessible = true`.
|
|
87
|
+
- **Example Code:**
|
|
88
|
+
`kotlin
|
|
89
|
+
val secretField = instance::class.java.getDeclaredField("secretMessage")
|
|
90
|
+
secretField.isAccessible = true`
|
|
91
|
+
|
|
92
|
+
- **Suggested Keep Rule:**
|
|
93
|
+
\`\`\`proguard
|
|
94
|
+
|
|
95
|
+
# Specifically keep the private field/method by name and type
|
|
96
|
+
|
|
97
|
+
-keepclassmembers class com.example.LibraryClass {
|
|
98
|
+
private java.lang.String secretMessage;
|
|
99
|
+
}
|
|
100
|
+
\`\`\`
|
|
101
|
+
|
|
102
|
+
### 6. Parcelable (Manual Implementation)
|
|
103
|
+
|
|
104
|
+
**Scenario:** Implementing `Parcelable` without using the `@Parcelize`
|
|
105
|
+
annotation.
|
|
106
|
+
|
|
107
|
+
- **Look for:** `implements Parcelable` and a static `CREATOR` field.
|
|
108
|
+
- **Example Code:**
|
|
109
|
+
`kotlin
|
|
110
|
+
class MyData : Parcelable {
|
|
111
|
+
// Manual implementation with CREATOR field
|
|
112
|
+
}`
|
|
113
|
+
|
|
114
|
+
- **Suggested Keep Rule:**
|
|
115
|
+
*(Note: If using `import kotlinx.parcelize.Parcelize`, R8/ProGuard rules are
|
|
116
|
+
generated automatically. If manual, use the following:)*
|
|
117
|
+
`proguard
|
|
118
|
+
-keepclassmembers class * implements android.os.Parcelable {
|
|
119
|
+
static android.os.Parcelable$Creator CREATOR;
|
|
120
|
+
}`
|
|
121
|
+
|
|
122
|
+
### 7. Enums and Obfuscation
|
|
123
|
+
|
|
124
|
+
**Scenario:** App uses `Enum.valueOf("STRING_NAME")` indirectly (e.g.,using JSON
|
|
125
|
+
deserialization) and the enum names get obfuscated.
|
|
126
|
+
|
|
127
|
+
- **Look for:** Unnecessary generic Enum keep rules in ProGuard files.
|
|
128
|
+
- **Example Code:**
|
|
129
|
+
\`\`\`proguard
|
|
130
|
+
|
|
131
|
+
# Unnecessary rule
|
|
132
|
+
|
|
133
|
+
-keepclassmembers enum \* { \*; }
|
|
134
|
+
\`\`\`
|
|
135
|
+
- **Suggested Keep Rule:**
|
|
136
|
+
\*(Note: The default `proguard-android-optimize.txt` already contains the optimal
|
|
137
|
+
rules for Enums (keeping `values()` and `valueOf(String)`). Any additional
|
|
138
|
+
manual rules for Enums are redundant.) # No manual rule needed. Use default
|
|
139
|
+
proguard-android-optimize.txt.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
## 1. Configuration
|
|
2
|
+
|
|
3
|
+
*(Optional section for the report, omit if no relevant findings are present.)*
|
|
4
|
+
|
|
5
|
+
- **AGP Version**: \[Current\] -\> Upgrade to 9.0.
|
|
6
|
+
- **Full Mode** : Not enabled. Remove `android.enableR8.fullMode=false` from `gradle.properties`.
|
|
7
|
+
|
|
8
|
+
## 2. Global disable rules
|
|
9
|
+
|
|
10
|
+
*(Optional section for the report, omit if no relevant findings are present.)*
|
|
11
|
+
|
|
12
|
+
- \[Rule\]: Disables R8 globally. **Action**: Remove.
|
|
13
|
+
|
|
14
|
+
If there is -dontobfuscate, -dontoptimize or -dontshrink in the codebase,
|
|
15
|
+
mention in this section
|
|
16
|
+
|
|
17
|
+
## 3. Optimization summary
|
|
18
|
+
|
|
19
|
+
- **Optimization score**: \[X\]% code is available for R8 optimizations (e.g., inlining, merging). \[100-X\]% of codebase can't be optimized by R8.
|
|
20
|
+
- **Shrinking score**: \[X\]% of code will be optimized by R8 by removing unused classes, fields and methods. \[100-X\]% of codebase contains redundant classes, fields and methods that can't be removed by R8.
|
|
21
|
+
- **Obfuscation score**: \[X\]% of the codebase is available for R8 to obfuscate.
|
|
22
|
+
|
|
23
|
+
Increasing these scores increases the codebase available to R8 for
|
|
24
|
+
optimizations.
|
|
25
|
+
|
|
26
|
+
## 4. Keep rules evaluation
|
|
27
|
+
|
|
28
|
+
### \[Rule text\]
|
|
29
|
+
|
|
30
|
+
- **Keeps**: \[X\] items or \[X\] % of the codebase from optimization. Classes: \[X\], Fields: \[X\], Methods: \[X\] are prevented from optimization due to this keep rule
|
|
31
|
+
- **Kept items**: \[Class1\], \[Class2\]
|
|
32
|
+
- **Action** : **Remove** (Library bundles rules) OR **Refine** (Too broad, use \[Surgical Rule\]).
|
|
33
|
+
|
|
34
|
+
## 5. Subsumed keep rules
|
|
35
|
+
|
|
36
|
+
*(Optional section for the report, omit if no relevant findings are present.)*
|
|
37
|
+
|
|
38
|
+
### \[Redundant rules\]
|
|
39
|
+
|
|
40
|
+
- **Subsumed By**: \[Broader Rule\]
|
|
41
|
+
- **Action** : **Remove**.
|
|
42
|
+
|
|
43
|
+
## 6. Historical analysis summary
|
|
44
|
+
|
|
45
|
+
*(Only include this section if a previous report existed. Summarize the changes
|
|
46
|
+
in optimization scores here to track progress. For example:)* The previous app
|
|
47
|
+
had scores: Optimization (XX%), Obfuscation (XX%), and Shrinking (XX%). The
|
|
48
|
+
current app has scores: Optimization (YY%), Obfuscation (YY%), and Shrinking
|
|
49
|
+
(YY%).
|
|
50
|
+
**Change**: Optimization improved by ZZ%, Obfuscation improved by ZZ%, and
|
|
51
|
+
Shrinking improved by ZZ%.
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
## Android skills
|
|
2
|
+
|
|
3
|
+
[View on GitHub](https://github.com/android/skills/tree/main/performance/r8-analyzer)
|
|
4
|
+
|
|
5
|
+
### R8 Analyzer
|
|
6
|
+
|
|
7
|
+
Use the R8 Analyzer [Android skill](https://developer.android.com/tools/agents/android-skills) to analyze build files and identify redundant, broad, or subsumed [keep rules](https://developer.android.com/topic/performance/app-optimization/keep-rules-overview). To install the skill from the [Android CLI](https://developer.android.com/tools/agents/android-cli), run:
|
|
8
|
+
|
|
9
|
+
android skills add r8-analyzer
|
|
10
|
+
|
|
11
|
+
<br />
|
|
12
|
+
|
|
13
|
+
For the best user experience, you should optimize your app to make it as small
|
|
14
|
+
and fast as possible. Our app optimizer, called R8, streamlines your app by
|
|
15
|
+
removing unused code and resources, rewriting code to optimize runtime
|
|
16
|
+
performance, and more. To your users, this means:
|
|
17
|
+
|
|
18
|
+
- Faster startup time
|
|
19
|
+
- Reduced memory usage
|
|
20
|
+
- Improved rendering and runtime performance
|
|
21
|
+
- Fewer [ANRs](https://developer.android.com/topic/performance/anrs/keep-your-app-responsive)
|
|
22
|
+
|
|
23
|
+
> [!IMPORTANT]
|
|
24
|
+
> **Important:** You should always enable optimization for your app's release build; however, you probably don't want to enable it for tests or libraries. For more information about using R8 with tests, see [Test and troubleshoot the
|
|
25
|
+
> optimization](https://developer.android.com/topic/performance/app-optimization/test-and-troubleshoot-the-optimization). For more information about enabling R8 from libraries, see [Optimization for library authors](https://developer.android.com/topic/performance/app-optimization/library-optimization).
|
|
26
|
+
|
|
27
|
+
## R8 optimization overview
|
|
28
|
+
|
|
29
|
+
R8 uses a multi-phase process to optimize your app for size and speed. Key
|
|
30
|
+
operations include the following:
|
|
31
|
+
|
|
32
|
+
- **Code shrinking (also known as tree shaking)** : R8 identifies and removes
|
|
33
|
+
unreachable code from your application and its library dependencies. By
|
|
34
|
+
analyzing the entry points of your app (such as `Activities` or `Services`
|
|
35
|
+
defined in the manifest), R8 builds a graph of referenced code and removes
|
|
36
|
+
anything that remains unreferenced.
|
|
37
|
+
|
|
38
|
+
- **Logical optimizations**: R8 rewrites your code to improve execution
|
|
39
|
+
efficiency and reduce overhead. Key techniques include:
|
|
40
|
+
|
|
41
|
+
- **Method inlining**: R8 replaces a method call site with the actual body
|
|
42
|
+
of the called method. This eliminates the overhead of a function call
|
|
43
|
+
and lets R8 conduct further optimizations.
|
|
44
|
+
|
|
45
|
+
- **Class merging**: R8 combines sets of classes and interfaces into a
|
|
46
|
+
single class. This reduces the number of classes in the app, lowering
|
|
47
|
+
memory pressure and improving startup speed.
|
|
48
|
+
|
|
49
|
+
- **Obfuscation (also known as minification)** : To reduce the size of the DEX
|
|
50
|
+
file, R8 shortens the names of classes, fields, and methods (for example,
|
|
51
|
+
`com.example.MyActivity` could become `a.b.a`).
|
|
52
|
+
|
|
53
|
+
Since 8.12.0 version of Android Gradle Plugin (AGP), R8 also optimizes resources
|
|
54
|
+
as part of its optimization phases. For more information, see [Optimized
|
|
55
|
+
resource shrinking](https://developer.android.com/topic/performance/app-optimization/enable-app-optimization#optimize-resource-shrinking).
|
|
56
|
+
|
|
57
|
+
## Enable optimization
|
|
58
|
+
|
|
59
|
+
To enable app optimization for your app use the appropriate DSL based on your
|
|
60
|
+
project's AGP version. We recommend enabling app optimization only in the final
|
|
61
|
+
version of your app that you test before publishing---usually your release
|
|
62
|
+
build---because the optimizations increase the build time of your project and can
|
|
63
|
+
make debugging harder due to the way it modifies code.
|
|
64
|
+
|
|
65
|
+
### For AGP versions 9.3 and higher
|
|
66
|
+
|
|
67
|
+
To enable app optimization for AGP 9.3 and higher:
|
|
68
|
+
|
|
69
|
+
- Set `enable = true` in the `optimization` block in your release build's app-level build script.
|
|
70
|
+
- Add your [keep rules](https://developer.android.com/topic/performance/app-optimization/add-keep-rules) to a file with the suffix `.keep` in the `src/<variant>/keepRules` source set. For example, `src/main/keepRules/custom-rules.keep`.
|
|
71
|
+
|
|
72
|
+
> [!NOTE]
|
|
73
|
+
> **Note:** The updated DSL enables both code and resource optimization. It also includes a set of default keep rules for the Android platform, equivalent to "proguard-android-optimize.txt". To omit the default rules, see [Omit default
|
|
74
|
+
> rules](https://developer.android.com/topic/performance/app-optimization/keep-rules-overview#omit-default).
|
|
75
|
+
|
|
76
|
+
### Kotlin
|
|
77
|
+
|
|
78
|
+
android {
|
|
79
|
+
buildTypes {
|
|
80
|
+
release {
|
|
81
|
+
optimization {
|
|
82
|
+
enable = true // Enables code and resource optimizations.
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
### Groovy
|
|
89
|
+
|
|
90
|
+
android {
|
|
91
|
+
buildTypes {
|
|
92
|
+
release {
|
|
93
|
+
optimization {
|
|
94
|
+
enable = true // Enables code and resource optimizations.
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
### Legacy DSL for AGP versions lower than 9.3
|
|
101
|
+
|
|
102
|
+
To enable app optimization, set `isMinifyEnabled = true` (for code optimization)
|
|
103
|
+
and `isShrinkResources = true` (for resource optimization) in your [release
|
|
104
|
+
build's](https://developer.android.com/studio/publish/preparing#turn-off-debugging) app-level build script. We recommend that you always enable both
|
|
105
|
+
settings.
|
|
106
|
+
|
|
107
|
+
### Legacy DSL (Kotlin)
|
|
108
|
+
|
|
109
|
+
android {
|
|
110
|
+
buildTypes {
|
|
111
|
+
release {
|
|
112
|
+
|
|
113
|
+
// Enables code optimizations.
|
|
114
|
+
isMinifyEnabled = true
|
|
115
|
+
|
|
116
|
+
// Enables resource shrinking.
|
|
117
|
+
isShrinkResources = true
|
|
118
|
+
|
|
119
|
+
proguardFiles(
|
|
120
|
+
// Default file with automatically generated optimization rules.
|
|
121
|
+
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
122
|
+
|
|
123
|
+
...
|
|
124
|
+
)
|
|
125
|
+
...
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
...
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
### Legacy DSL (Groovy)
|
|
132
|
+
|
|
133
|
+
android {
|
|
134
|
+
buildTypes {
|
|
135
|
+
release {
|
|
136
|
+
|
|
137
|
+
// Enables code optimizations.
|
|
138
|
+
minifyEnabled = true
|
|
139
|
+
|
|
140
|
+
// Enables resource shrinking.
|
|
141
|
+
shrinkResources = true
|
|
142
|
+
|
|
143
|
+
// Default file with automatically generated optimization rules.
|
|
144
|
+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt')
|
|
145
|
+
|
|
146
|
+
...
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
## Improve R8 optimization
|
|
152
|
+
|
|
153
|
+
The performance benefits of R8 are directly correlated to how much of your
|
|
154
|
+
codebase R8 is able to optimize. To get the maximum benefits out of R8, follow
|
|
155
|
+
best practices:
|
|
156
|
+
|
|
157
|
+
- Enable R8 in [full mode](https://developer.android.com/topic/performance/app-optimization/full-mode)
|
|
158
|
+
- Enable [obfuscation, optimization, and shrinking](https://developer.android.com/topic/performance/app-optimization/adopt-optimizations-incrementally)
|
|
159
|
+
- Enable resource shrinking and [optimized resource shrinking](https://developer.android.com/topic/performance/app-optimization/enable-app-optimization#optimize-resource-shrinking)
|
|
160
|
+
- [Refine keep rules](https://developer.android.com/topic/performance/app-optimization/keep-rules-best-practices) to allow maximum optimization of classes, fields and methods.
|
|
161
|
+
|
|
162
|
+
To help you refine keep rules, use the [R8 Configuration Analyzer](https://developer.android.com/topic/performance/app-optimization/r8-configuration-analyzer).
|
|
163
|
+
|
|
164
|
+
The R8 Configuration Analyzer lets you do the following:
|
|
165
|
+
|
|
166
|
+
- Track and improve the overall R8 configuration quality by monitoring the metrics provided by the R8 Configuration Analyzer report.
|
|
167
|
+
- Find the broadest keep rules - those which prevent the most optimization
|
|
168
|
+
- and understand what optimization they prevent to refine them.
|
|
169
|
+
|
|
170
|
+
The R8 Configuration Analyzer is available in AGP version 9.3.0-alpha05 or from
|
|
171
|
+
R8 version 9.3.7-dev. For more information, see [Analyze R8 configuration](https://developer.android.com/topic/performance/app-optimization/r8-configuration-analyzer).
|
|
172
|
+
|
|
173
|
+
## Optimize resource shrinking for even smaller apps
|
|
174
|
+
|
|
175
|
+
The 8.12.0 version of AGP introduces optimized resource shrinking, which aims to
|
|
176
|
+
integrate resource and code optimization to create even smaller and faster apps.
|
|
177
|
+
Before optimized resource shrinking, Android Asset Packaging Tool (AAPT2)
|
|
178
|
+
generated keep rules that effectively treating resource shrinking separately
|
|
179
|
+
from code, often retaining inaccessible code or resources that referenced each
|
|
180
|
+
other.
|
|
181
|
+
|
|
182
|
+
With optimized resource shrinking, resources are considered like a part of
|
|
183
|
+
program code, forming the reference graph. When a collection of code or
|
|
184
|
+
resources is not referenced, it is not protected by a keep rule, and can be
|
|
185
|
+
removed.
|
|
186
|
+
|
|
187
|
+
### Enable optimized resource shrinking
|
|
188
|
+
|
|
189
|
+
To enable the new optimized resource shrinking pipeline for AGP 8.12 or 8.13,
|
|
190
|
+
add the following to your project's `gradle.properties` file:
|
|
191
|
+
|
|
192
|
+
android.r8.optimizedResourceShrinking=true
|
|
193
|
+
|
|
194
|
+
If you are using AGP 9.0.0 or a newer version, you don't need to set
|
|
195
|
+
`android.r8.optimizedResourceShrinking=true`. Optimized resource shrinking is
|
|
196
|
+
automatically applied when `isShrinkResources = true` is enabled in your build
|
|
197
|
+
configuration.
|
|
198
|
+
|
|
199
|
+
## Verify and configure R8 optimization settings
|
|
200
|
+
|
|
201
|
+
To enable R8 to use its [full optimization capabilities](https://developer.android.com/topic/performance/app-optimization/full-mode), remove the
|
|
202
|
+
following line from your project's `gradle.properties` file, if it exists:
|
|
203
|
+
|
|
204
|
+
android.enableR8.fullMode=false
|
|
205
|
+
|
|
206
|
+
Note that enabling app optimization makes stack traces difficult to understand,
|
|
207
|
+
especially if R8 renames class or method names. To get stack traces that
|
|
208
|
+
correctly correspond to your source code, see [Recover the original stack
|
|
209
|
+
trace](https://developer.android.com/topic/performance/app-optimization/test-and-troubleshoot-the-optimization#recover-original-stack-trace).
|
|
210
|
+
|
|
211
|
+
If R8 is enabled, you should also [create Startup Profiles](https://developer.android.com/topic/performance/baselineprofiles/dex-layout-optimizations) for even better
|
|
212
|
+
startup performance.
|
|
213
|
+
|
|
214
|
+
If you enable app optimization and it causes errors, here are some strategies to
|
|
215
|
+
fix them:
|
|
216
|
+
|
|
217
|
+
- [Add keep rules](https://developer.android.com/topic/performance/app-optimization/add-keep-rules) to keep some code untouched.
|
|
218
|
+
- [Adopt optimizations incrementally](https://developer.android.com/topic/performance/app-optimization/adopt-optimizations-incrementally).
|
|
219
|
+
- Update your code to [use libraries that are better suited for
|
|
220
|
+
optimization](https://developer.android.com/topic/performance/app-optimization/choose-libraries-wisely).
|
|
221
|
+
|
|
222
|
+
> [!CAUTION]
|
|
223
|
+
> **Caution:** Tools that replace or modify R8's output can negatively impact runtime performance. R8 is careful about including and testing many optimizations at the code level, in [DEX layout](https://developer.android.com/topic/performance/baselineprofiles/dex-layout-optimizations), and in correctly producing Baseline Profiles - other tools producing or modifying DEX files can break these optimizations, or otherwise regress performance.
|
|
224
|
+
|
|
225
|
+
If you are interested in optimizing your build speed, see [Configure how R8
|
|
226
|
+
runs](https://developer.android.com/build/r8-execution-profiles) for information on how to configure R8 based on your environment.
|
|
227
|
+
|
|
228
|
+
## AGP and R8 version behavior changes
|
|
229
|
+
|
|
230
|
+
The following table outlines the key features introduced in various versions of
|
|
231
|
+
the Android Gradle Plugin (AGP) and the R8 compiler.
|
|
232
|
+
|
|
233
|
+
| AGP version | Features introduced |
|
|
234
|
+
|---|---|
|
|
235
|
+
| 9.3 | **Simplified DSL:** New \`optimization {}\` block enables requires less configuration- optimized resource shrinking is always enabled, default Android keep rules are opt-out. <br /> **\`keepRules\` source set:** If you use the new DSL, you must place your keep rules in the `src/<variant>/keepRules` source set, in files with the suffix `.keep`. The source sets are also compatible with the legacy DSL. <br /> **KMP (Kotlin MultiPlatform) consumer rules:** KMP no longer requires setting `publish = true`, and supports the `src/<variant>/keepRules` source set with the `.keep` extension. <br /> Note that the legacy DSL is still supported. |
|
|
236
|
+
| 9.1 | **Classes repackaged by default:** R8 repackages classes (moving them to the unnamed package, at the top level) to compact DEX further, eliminating the need to specify `-repackageclasses` option. For information about how this works and how to opt out, see [global options](https://developer.android.com/topic/performance/app-optimization/global-options#global-options). |
|
|
237
|
+
| 9.0 | **Optimized resource shrinking:** Enabled by default (controlled using `android.r8.optimizedResourceShrinking`). [Optimized resource shrinking](https://developer.android.com/topic/performance/app-optimization/enable-app-optimization#optimize-resource-shrinking) helps integrate resource shrinking with the code optimization pipeline, leading to smaller, faster apps. By optimizing both code and resource references simultaneously, it identifies and removes resources referenced exclusively from unused code. This is a significant improvement over the previous separate optimization processes. This is especially useful for apps that share substantial resources and code across different form factor verticals, with measured improvements of over 50% in app size. The resulting size reduction leads to smaller downloads, faster installations, and a better user experience with faster startup, improved rendering, and fewer ANRs. **Library rule filtering:** Support for global options (for example, `-dontobfuscate`) in library consumer rules has been dropped, and apps will filter them out. For more information, see [Add global options](https://developer.android.com/topic/performance/app-optimization/global-options). **Kotlin null checks:** Optimized by default (controlled using `-processkotlinnullchecks`). This version also introduced significant improvements in build speed. For more information, see [Global options for additional optimization](https://developer.android.com/topic/performance/app-optimization/global-options#global-options). **Optimize specific packages:** You can use `packageScope` to optimize specific packages. This is in experimental support. For more information, see [Optimize specified packages with `packageScope`](https://developer.android.com/topic/performance/app-optimization/optimize-specified-packages). **Optimized by default:** Support for `getDefaultProguardFile("proguard-android.txt")` has been dropped, because it includes `-dontoptimize`, which should be avoided. Instead, use `"proguard-android-optimize.txt"`. If you need to globally disable optimization in your app, [add the flag manually to a proguard file](https://developer.android.com/topic/performance/app-optimization/global-options#global-options-2). |
|
|
238
|
+
| 8.12 | **Optimized resource shrinking:** Initial support added (controlled using `android.r8.optimizedResourceShrinking`). [Optimized resource shrinking](https://developer.android.com/topic/performance/app-optimization/enable-app-optimization#optimize-resource-shrinking) helps integrate resource shrinking with the code optimization pipeline. You must manually enable it in this version of AGP. **Logcat retracing:** Support for automatic retracing in the Android Studio [Logcat window](https://developer.android.com/studio/debug/logcat). |
|
|
239
|
+
| 8.6 | **Improved retracing:** Includes filename and line number retracing by default for all `minSdk` levels (previously required `minSdk` 26+ in version 8.2). Updating R8 helps ensure that stack traces from obfuscated builds are readily and clearly readable. This version improves how line numbers and source files are mapped, making it easier for tools like the Android Studio Logcat to automatically retrace crashes to the original source code. |
|
|
240
|
+
| 8.0 | **Full mode by default:** [R8 full mode](https://developer.android.com/topic/performance/app-optimization/full-mode) provides significantly more powerful optimization. It is enabled by default. You can opt out using `android.enableR8.fullMode=false`. |
|
|
241
|
+
| 7.0 | **Full mode available:** Introduced as an opt-in feature using `android.enableR8.fullMode=true`. Full mode applies more powerful optimizations by making stricter assumptions about how your code uses reflection and other dynamic features. While it reduces app size and improves performance, it might require additional keep rules to prevent necessary code from being stripped. |
|
|
242
|
+
|
|
243
|
+
## Use R8 with other build systems
|
|
244
|
+
|
|
245
|
+
While AGP is the recommended and officially supported build system for Android
|
|
246
|
+
apps, you might use an alternative build system like [Bazel](https://bazel.build/). If
|
|
247
|
+
you're using Bazel, you can integrate R8 into your build pipeline to shrink,
|
|
248
|
+
obfuscate, and optimize your app.
|
|
249
|
+
|
|
250
|
+
For information about optimizing an Android app using Bazel, see Bazel's
|
|
251
|
+
[`rules_android` documentation](https://github.com/bazelbuild/rules_android/tree/main/docs/r8-optimization.md). Note that Bazel isn't
|
|
252
|
+
[officially supported](https://developer.android.com/build#other-build-systems) for Android app development.
|