For developers building Android apps intended for Web to App and App Engagement campaigns, ensuring deep links are correctly implemented and validated is crucial. Android Studio, the official Integrated Development Environment (IDE) for Android, provides a dedicated tool called the App Links Assistant. This assistant streamlines the process of creating, testing, and troubleshooting deep links, specifically for the Android Manifest configuration and the necessary website association files (assetlinks.json).
This article details how you can use the App Links Assistant to ensure your app's deep links are robust and ready.
On this page
- Benefits of using the App Links Assistant
- How the App Links Assistant work
- How to use the App Links Assistant
Benefits of using the App Links Assistant
- Greater accuracy and efficiency: Helps you reduce manual errors in configuring intent filters and
assetlinks.jsonfiles and automates parts of the validation and fixing process. - Comprehensive checks: Helps you validate against Android platform requirements for deep links and app links.
- Centralized management: Provides a single interface within Android Studio to oversee and manage your app's deep link setup.
How the App Links Assistant works
The App Links Assistant is a bundled plugin within Android Studio designed to simplify the complexities of deep link implementation for Android apps. It helps you manage both the app-side configuration (in the AndroidManifest.xml file) and the website-side verification (the assetlinks.json file) required for functional deep links, especially Android App Links (which use http and https schemes).
Key features of the App Links Assistant
The App Links Assistant offers several features to help you manage and validate deep links:
- Discovering existing deep links: The assistant scans your app's
AndroidManifest.xmlfile and displays a table that lists all detected deep link patterns (intent filters configured to handle URLs). This gives you a quick overview of all entry points into the app through URLs. - Validating Android Manifest configuration (App checks): Automatically analyzes each discovered deep link for common configuration issues within the manifest. This includes checking for:
- Presence of required
<data>tag attributes likeandroid:scheme,android:host - Correct intent actions like
ACTION_VIEW - Necessary categories like
BROWSABLE,DEFAULT - The
autoVerify="true"attribute for Android App Links
- Presence of required
- Fixing Manifest issues: For many common manifest misconfigurations, the App Links Assistant provides "Fix" buttons that can automatically correct the issues in your
AndroidManifest.xmlfile. If an issue can’t be automatically fixed, the assistant will guide you to the relevant section of the manifest for manual correction. - Validating web associations (
assetlinks.json) (Web checks): The assistant helps verify that your website is correctly set up to associate with your app, which is crucial for Android App Links (http/httpsURLs). It checks the following:- File existence and location: Ensures the
assetlinks.jsonfile is present athttps://your-domain.name/.well-known/assetlinks.json. - HTTPS accessibility: Confirms the file is served over a secure HTTPS connection.
- JSON validity and content: Verifies the
assetlinks.jsonfile is well-formed and contains the correct statements, including your app'spackage_nameandsha256_cert_fingerprints. - Content type header: Checks that the server serves the file with the
application/jsoncontent type. - No redirects: Ensures the file is accessible directly without any HTTP 301 or 302 redirects.
- File existence and location: Ensures the
- Generating and managing
assetlinks.json:- Generation: If you don't have an assetlinks.json file, or if yours is incorrect, the assistant can help generate a properly formatted one.
- Different view: Check a comparison between existing (fetched)
assetlinks.jsonfile and a corrected or newly generated version, making it easy to check what changes are needed. - Download: The corrected
assetlinks.jsonfile can be downloaded directly from the assistant, ready to upload to web servers.
How to use the App Links Assistant
While specific steps might vary based on the task, here’s a general workflow of how to use the App Links Assistant.
- In Android Studio, navigate to View.
- Select Tool Windows and then App Links Assistant or Tools.
- Select App Links Assistant.
- Review detected deep links.
- The assistant will display all deep links found in your project's manifest.
- Run app checks.
- Initiate validation for the Android Manifest configurations. Review any reported errors or warnings.
- Fix Manifest issues.
- Use the "Fix" options for automatic corrections or manually edit the manifest based on the assistant's guidance.
- Run web checks for Android App Links.
- For
http/httpslinks, initiate the web association validation. The assistant will attempt to fetch and analyze theassetlinks.jsonfile from the domains specified in your manifest.
- For
- Review web check results.
- Address any issues reported, such as problems with the
assetlinks.jsonfile's content, hosting, or accessibility.
- Address any issues reported, such as problems with the
- Generate or update
assetlinks.json.- If needed, use the assistant to generate a new
assetlinks.jsonfile or to check a diff and download an updated version. Upload this file to the/.well-known/directory on all relevant domains.
- If needed, use the assistant to generate a new
- Revalidate.
- After making changes to your manifest or assetlinks.json file, re-run the checks in the App Links Assistant to confirm all issues are resolved.
