Troubleshoot monitoring of mobile apps on Android
Find out how to solve problems related to Android mobile app monitoring.
Manual instrumentation
By default, OneAgent for Android assigns the WebRequestTiming
object to the last action. To use other action, tag the web request before you create the WebRequestTiming
object. The following example (see point 2a
and 2b
) shows how you can assign the WebRequestTiming
object to the webAction
variable instead of the otherAction
variable.
HttpURLConnection conn = null;
WebRequestTiming timing = null;
// [1] First, create an action
DTXAction webAction = DESK.enterAction("time service");
DTXAction otherAction = DESK.enterAction("dummy action");
try {
URL url = new URL("http://myhost.mydomain.com/TimeService?tz=CET");
conn = (HttpURLConnection) url.openConnection();
// [2a] Select your own action
webAction.tagRequest(connection);
// [2b] Use the existing tag and return the WebRequestTiming object
timing = DESK.getWebRequestTiming(conn);
// [3] Call startWebRequestTiming() to begin the timing, and then handle the input
// stream from the connection
timing.startWebRequestTiming();
InputStream stream = new BufferedInputStream(conn.getInputStream());
readStream(stream);
// [4] Once done reading, timing can stop
timing.stopWebRequestTiming();
} catch (Exception e) {
// Attach the exception to the action
webAction.reportError("Exception", e);
// user-defined exception handling
} finally {
// [5] Lastly finalize the timing and the action in the finally block.
// This allow us to receive timings and close the action even if there is an
// exception thrown
if (timing != null) {
timing.stopWebRequestTiming();
}
webAction.leaveAction();
if (conn != null) {
conn.disconnect();
}
}
Only web requests from a supported HTTP framework are captured. Check if your HTTP framework is in this list. If not, you must instrument your web requests manually.
Auto-instrumentation
Yes, all frameworks based on OkHttp 3
are supported.
Only web requests from a supported HTTP framework are captured. Check if your HTTP framework is in this list. If not, you must instrument your web requests manually.
OneAgent for Android only attaches web requests to a user action triggered within a specific timeframe. The timeframe starts when the action opens, and ends 500 ms
after the action closes. You can change this value with the DTXAutoActionTimeoutMilliseconds
property.
MenuItems:
- getTitle()
Other views:
view.getContentDescription()
if not null.getText()
for a TextView (or subclass of).- For
LinearLayout
the name is determined by looking at the children. - The class name is used as backup.
There can be multiple reasons why OneAgent for Android can't create a user action:
- The UI component is defined in a WebView.
- The listener method is defined in a resource XML file.
- The UI component uses an unsupported listener. The User action monitoring section in Auto-instrumentation for Android lists all supported listeners.
Enable the DTXSendEmptyAutoAction
property if your user interaction does not trigger a web request or lifecycle change. OneAgent for Android discards empty user actions by default.
You may be running your application in development or testing mode (not signed and deployed to Google Play) with a Google Maps release API key.
Yes. The instrument.sh
and instrument.cmd
files have a default maximum heap (-Xmx
) setting. If you experience an out-of-memory exception, you can increase the memory by updating that setting.
When the crash happens at the app startup phase on devices with Android 4.4 or lower, the mentioned class is not part of the primary .dex
file. Update the DTXMultiDexKeep
and/or DTXMultiDexKeepFile
property to resolve the issue. See Using multiple .dex files for Android instrumentation for details.
DESK Gradle plugin
For version 2.2 and later of the Android Gradle plugin, the DESK Gradle plugin generates an uninstrumented APK file with a file suffix of _uninstrumented
. In some cases it can be useful to have an uninstrumented version of the application, for example if you notice that OneAgent for Android interferes with another library. If you use manual instrumentation, then the manual instrumentation is still part of the _uninstrumented
APK file.
Check if you have uploaded the correct file: <project>/<module>/build/outputs/apk/<app_name>.apk
. Do not use the APKs in the
<project>/<module>/build/outputs/apk/<app_name>/dist
directory, because they are unsigned or signed with a debug certificate.
General issues
Only activities defined in AndroidManifest.xml
are instrumented.
There can be multiple reasons why OneAgent for Android can't create a user action:
- The UI component is defined in a WebView.
- The listener method is defined in a resource XML file.
- The UI component uses an unsupported listener. The User action monitoring section in Auto-instrumentation for Android lists all supported listeners.
Enable the DTXSendEmptyAutoAction
property if your user interaction does not trigger a web request or lifecycle change. OneAgent for Android discards empty user actions by default.
You may be running your application in development or testing mode (not signed and deployed to Google Play) with a Google Maps release API key.
There can be multiple reasons for this problem:
- Verify if you used the correct property values that are provided by your monitoring application
- Did you adapt the
Network Security Configuration
correctly? You have to include system CA certificates or the certificate to your public Managed Cluster ActiveGate. - Check if DESK or your public Managed Cluster ActiveGate is reachable from within your company network.
- DESK Managed: Does the public Managed Cluster ActiveGate have a valid certificate?
No. For efficiency, DESK does not accept monitoring data older than 10 minutes.
OneAgent for Android truncates most (user-related) values, if they exceed the border limit value of 250.
OneAgent for Android uses the default log framework from Android. You can use the logcat monitor from Android Studio or the command-line tool logcat to view these log lines.
A 'Max. user actions per minute exceeded' event informs you that the number of user actions generated from Real User Monitoring (Web, Mobile, and OpenKit) has exceeded a limit that is specific to your environment. Once this limit is reached, DESK automatically throttles the number of user sessions being captured until the number of user actions is below the limit again. The throttling is done on a user session basis in order to provide statistically correct values in DESK. If the overall traffic volume drops, DESK will automatically return to the capturing rate you've set for your environment.
Why does DESK change the capture rate?
The maximum user action count per minute limit is specific to your environment and is there to prevent unexpected high consumption of your license volume by unexpected IT events like unannounced marketing campaigns, unplanned load tests, DDoS attacks, aggressive web scanners, or other.
What is the impact on the data visible in the DESK UI?
During the period of the event, DESK reduces the amount of captured user sessions. Some of the sessions aren't captured and therefore no further analysis is applied. This means all count metrics are impacted (for example, user session count, user action count, and conversion count). Rate metrics aren't impacted since sessions are either captured fully or not at all. This includes, for example, JavaScript error rate, conversion rate, crash rate, and bounce rate.
Can my environment limit be changed?
The environment limit can be adjusted. For details, please contact the DESK ONE team or your sales representative.
The maximum user action count per minute limit is specific to your environment. You can configure this limit at Environments > Cluster Management Console.
How do I know if my RUM application has exceeded the limit?
The User sessions page displays the following type of alert:
The Maximum user actions per minute limit events are listed under the Events and Impact of user actions on performance sections of the corresponding application overview page.
An alert is also displayed under the Performance section of User actions.