Android Skills

repository·main·Indexed 27 days ago

https://github.com/android/skills

A repository of AI-optimized, modular instructions (SKILL.md files) designed to help LLMs execute specific Android development patterns and workflows following official best practices. Includes guidance on using the Android CLI to install skills and detailed references for migrating from Camera1 and Camera2 to CameraX, including implementation details for Jetpack Compose and Android Views.

Tokens
240.5K
Snippets
392
Records
993
Agent score
91%

What's inside android-skills

  1. Overview of Navigation 3 features

    main

    Navigation 3 provides a flexible app navigation system with the following capabilities:

    • Back stack modeling: Conventions for representing navigated content via back stack entries.
    • Automatic UI updates: A UI layer that reacts to back stack changes with built-in animations.
    • State retention: A scope for back stack items that allows state to be retained while an item remains in the stack.
    • Adaptive layouts: An adaptive system that allows multiple destinations to be displayed at once and enables seamless switching between layouts.
    • Metadata communication: A mechanism for content to communicate with its parent layout via metadata.
  2. Overview of Engage SDK integration

    main

    The Engage SDK allows developers to deliver personalized recommendations and continuation content to multiple on-device Android surfaces, including Collections, Entertainment Space, and the Play Store.

    Integrating the SDK is lightweight, adding less than 50 KB (compressed) to the average APK, and is designed to be implemented within approximately one week of developer time. This specific guide focuses on instructions for developer partners to deliver audio content (music, podcasts, audiobooks, and live radio) to Engage content surfaces.

  3. Integrate Engage SDK for personalized recommendations

    main
    Integrate the Engage SDK to deliver personalized recommendations and continuation content to Android surfaces such as Collections, Entertainment Space, and the Play Store. This integration allows you to reach users across multiple on-device surfaces to boost app engagement. The integration is lightweight, adding less than 50 KB (compressed) to the average APK.
  4. Use r8-analyzer to optimize Android build files and R8 keep rules

    main
    The r8-analyzer is used to analyze Android build files (build.gradle, build.gradle.kts) and R8 keep rules. It helps identify redundancies, overly broad package-wide rules, and rules that subsume library consumer keep rules. Use this tool to optimize app size, remove redundant rules, or troubleshoot Proguard configurations.
  5. Understand Engage cluster types and limits

    main

    The Engage integration uses three types of clusters to group content. Each type has specific limits on the number of clusters and entities allowed:

    Cluster typeCluster limitsMaximum entity limits in a cluster
    Recommendation Cluster(s)At most 7At most 50
    Continuation ClusterAt most 1At most 20
    Featured ClusterAt most 1At most 20
    • Recommendation Cluster: Personalized suggestions from a single developer partner.
    • Continuation Cluster: Shows unfinished content (e.g., books) from multiple partners. Each partner can broadcast a maximum of 10 entities here.
    • Featured Cluster: A single high-priority cluster at the top of the UI showcasing items from multiple partners. Each partner can broadcast up to 10 entities here.
  6. Understand the R8 Analyzer report format

    main

    The R8 Analyzer report provides a structured analysis of how R8 (the Android code shrinker, obfuscator, and optimizer) interacts with your codebase. The report is divided into several key sections to help you identify configuration issues, global disable rules, optimization opportunities, and redundant keep rules.

    Key sections include:

    • Configuration: Highlights AGP version requirements and Full Mode settings.
    • Global disable rules: Identifies flags like -dontobfuscate, -dontoptimize, or -dontshrink that prevent R8 from working.
    • Optimization summary: Provides scores for Optimization, Shrinking, and Obfuscation.
    • Keep rules evaluation: Analyzes specific keep rules to determine if they are too broad or redundant.
    • Subsumed keep rules: Lists rules that are already covered by broader rules.
    • Historical analysis summary: Compares current scores against previous reports to track progress.
  7. Understand the Compose Styles layer

    main

    The Styles API introduces a new abstraction layer between subsystem values (tokens) and functional UI components. This layer allows for more granular customization than traditional global token overrides.

    LayerResponsibilityExample
    Subsystem valuesNamed valuesval Primary = Color(0xFF34A85E)
    Atomic StylesStyle that does exactly one property changeval largeSizeAtomic = Style { size(100.dp, 40.dp) }
    Component StylesComponent-specific configurationsA Button with Primary background and 16dp padding.
    ComponentsThe functional UI element that consumes a Style.Button(style = buttonStyle) { ... }
  8. Integrate Engage SDK for personalized content delivery

    main
    Integrate the Engage SDK to deliver personalized recommendations and continuation content to Android surfaces such as Collections, Entertainment Space, and the Play Store. This integration allows travel and events content to reach users across multiple on-device surfaces. The integration is lightweight, adding less than 50 KB (compressed) to the average APK, and typically requires approximately one week of developer time.
  9. Understand Digital Credentials on Android

    main

    Digital credentials are cryptographically verifiable documents (e.g., mobile driver's licenses, digital passports, boarding passes) used to authenticate or authorize users. They are stored in virtual containers called holders (wallets).

    In the Android ecosystem, the interaction involves three main roles:

    1. Issuer: The entity that creates the credential and asserts claims (e.g., a government or university).
    2. Holder (Wallet): An app that stores credentials. Wallets must register their metadata with Credential Manager to appear in the selection UI.
    3. Verifier: The app or service requesting the credential to grant access.

    Credential Manager acts as the intermediary: it matches credentials across wallets based on a request, presents a selection UI to the user, and directs the transaction flow to the appropriate wallet once a selection is made.

  10. Handle SMS and Call Log permissions

    main

    Access to SMS and Call Log data is highly restricted (Policy ID: sms_call_log_policy).

    Recommendations:

    • OTP/Account Verification: Instead of requesting SMS permissions to read verification codes, migrate to the SMS Retriever API or SMS User Consent API, which require zero permissions.
    • Non-core features: Completely remove SMS/Call Log permissions if they are used for secondary features like dashboards or notifications.
    • Default Handlers: If your app is a legitimate default SMS/Call handler, you must submit a Permissions Declaration Form in the Play Console.