Test Your Implementation

This document describes a variety of ways you can test your implementation, from the URLs in your manifest, to the completed app in production.

Testing URLs with Android Studio

When developing the manifest for your app, you can use the following utilities to help you build and test URLs.

Lint Checks for Links

When creating your manifest to support URLs to your app, use Android Studio lint version 2.x, which flags syntax errors for your intent filters. It automatically and continuously scans your manifest and raises errors in your manifest as described below.

To turn off automatic URL checking:

  1. Choose File > Other Settings > Default Settings > Editor > Inspections > Android Lint.
  2. Uncheck Incorrect usage of app link for Google App Indexing and Missing support for Google App Indexing.

Manually run syntax checking by selecting Analyze > Inspect Code from the application or right-click menu. See both the lint documentation for Android Studio and Configuring lint in Android.

HTTP URL syntax warnings appear highlighted in yellow.

HTTP URL errors are indicated by a red underline.

All errors appear in the bottom pane of the editor window, for quick access to the line in your manifest.

Link Testing in Android Studio

Use the Deep Link Testing feature for Android Studio version 2.x feature to verify that your app can be launched with a specified URL. To set this up, first select Run > Edit Configurations from the Android Application > General section. To test a HTTP URL, select Deep link in the Launch Options, and then input the URL to test. If the link is successful, the app should launch in the emulator or on the connected device. Otherwise, an error message appears in the Run window.

Android Debug Bridge

Test that your links open your app by using the Android Debug Bridge, where {URL} represents the HTTP URL declared in your app manifest. See Alternate Android Indexing Methods.

      adb shell am start -a android.intent.action.VIEW -d "{URL}" com.example.android
    

Testing App Indexing API behavior

Use the following utilities to make sure your API implementation has correct syntax and is error free.

Java Lint checking

Android Studio v2.x offers Java lint checking for your API integration. You can have this lint checking happen automatically, or use it manually.

  1. Automatic lint checking — Check Incorrect usage of app link for Google App Indexing and Missing support for Google App Indexing in File > Other Settings > Default Settings > Editor > Inspections > Android Lint.
  2. Manual lint checking — Use Analyze > Inspect Code.

The bottom pane of the editor window lists all lint issues. Select one to jump to the related code containing the error.

Android Debug Bridge

Use the Android Debug Bridge to log and verify data sent in your App Indexing API calls.

  1. Enable the logs:
    adb shell setprop log.tag.AppIndexApi VERBOSE
  2. View the logs:
    adb logcat -v time -s AppIndexApi:V
  3. Launch the app activity that triggers the App Indexing API call.

After that, you can see API calls in the logs.

Review the App Indexing API log

If the activity launched by a HTTP URL is integrated with the App Indexing API, you can use the Android Monitor to review the App Indexing API calls recorded in the AppIndexAPI log. To review the log, change the Android Monitor settings as follows:

  1. Set Log level to Verbose.
  2. Enter appindex in the Search field.
  3. Select No Filters from the Filter drop down list on the right.
    Android Monitor settings

If you don't see App Indexing log entries, do the following:

  • Install Google Play Services on the device or emulator.
  • Verify that the installed Google Play Services version is higher than the version specified in build.gradle.

Testing your completed app

Once you've created the manifest and implemented the App Indexing API, you can test your completed app as follows.

Preview Search Result on Android

Test autocompletions

Make sure that query autocompletions appear on those pages that make API calls. To do this, start with a new build of your app and visit a few pages that call the API. Then, visit the Google app on the device and type in a query that is relevant to your app. You should see query results in the list that show your app icon and lead directly to those pages on your app.

Preview your APK on Search Console

Upload your APK to Search Console to use the "Fetch as Google" feature to find and debug errors that Google systems encounter when crawling your app. You do not need an app-to-site association for this preview, but the app must be published on Google Play at least 24 hours prior to testing. You must also be a Google Play owner of the app. See Use Fetch as Google for Apps for details.

Use Search Console

Once you publish your app on Google Play, add it to Search Console and associate it to your site. (See Search Console for Apps in the Help Center.) Google will start indexing your app, and after a few days, you can check the Crawl Error reports to make sure our systems have accessed your app content. See the Crawl Errors Report documentation for details.

HTTP URL testing tool

Use the QR code generator to ensure correct formatting and behavior. Enter a HTTP URL in the text box below to generate a QR code that you scan using an Android barcode scanner app. This should open a browser page with a link. When you click on the link on your phone, it should open the HTTP URL you have entered in the text box.

Finally: Measure Impact

Send feedback about...

Need help? Visit our support page.