Android Instant Apps allow users to quickly use your applications without installation. With the Android agent version 5.17.0 and higher, you can use New Relic to detect and instrument all feature modules for an instant app.
Use this documentation along with the standard New Relic procedures to install Android apps with Gradle and Android Studio. After following the standard installation procedures, follow these additional steps for Android instant apps.
This procedure uses the following terms that are specific to the Android Instant Apps plugin:
- Module: Any packaged class and/or resource collection
- APK: A module that packages the apps resources and DEX’ed classes
- Feature module: A slimmed down module that contains only a subset of the total APK
To install the New Relic plugin for Android Instant Apps:
First follow the steps in the Install Android apps with Gradle and Android Studio documentation.
Apply the agent plugin in every project Gradle build file.
List the Android agent as a dependency.
Start the agent from each Activity class in the feature that could be side-loaded through a Digital Asset Link intent, (for example, mobile.example.com/signin).
Review the considerations for instrumentation.
When instrumenting an instant app, be aware of the following considerations with APKs:
Instant apps and APKs
ProGuard and Dexguard support for feature and application APKs
The Android Studio Gradle plugin will obfuscate any build configuration where
minifyEnabled is set to
true. In these conditions, the New Relic agent will forward the ProGuard map generated for the build to crash collectors, tagged with a unique build ID generated by the agent.
Obfuscation is best configured in the application or instant app project that includes other modules as dependencies. Modules may configure ProGuard as needed.
When using ProGuard or DexGuard with Android apps, follow the procedures to complete the additional, required configuration steps. For more information, see the ProGuard and DexGuard configuration documentation.
If you are not whether the agent is auto-instrumenting an instant app project, try running these steps:
Build app with
--debug) option, and capture the build log.
Search the log for evidence of instant apps by looking for either of these terms:
- This appears to be an Instant App
The agent will add an attribute named
'instantApp'to the app's Insights session attributes if the app appears to be an instant app.