Error descriptions

The following sections describe common errors that you might encounter while working with the AppMetrica SDK on Android.

  1. Error when adding the library to a project
  2. Incorrect duration of user session during manual tracking
  3. High power consumption of the AppMetrica library

Error when adding the library to a project

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:502)
at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:491)
at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:277)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:168)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)

This error indicates that the method limit was exceeded at the DexIndexOverflowException stage of processing. We recommend reviewing the libraries used — perhaps they are very heavy. If they can't be replaced with lightweight alternatives, you can use multiple DEX files. This might increase the app loading time.

Incorrect duration of user session during manual tracking

If the manual tracking of the user session is incorrectly implemented, it may lead to an inaccurate determination of its duration.

If the user session duration data doesn't look correct, make sure that when the user session ends, the YandexMetrica.pauseSession() method is always called. If this method is not called, the library assumes that the session is active and continues to exchange data with the server part of AppMetrica.

It is recommended to check the duration of the session timeout. It is specified with the withSessionTimeout() method. The timeout specifies the time interval during which the session will be considered active even after the application is closed.

High power consumption of the AppMetrica library

If there is the increased power consumption of the library, make sure that when the user session ends, the YandexMetrica.pauseSession() method is always called. If this method is not called, the library assumes that the session is active and continues to exchange data with the server part of AppMetrica.

It is recommended to check the duration of the session timeout. It is specified with the withSessionTimeout() method. The timeout specifies the time interval during which the session will be considered active even after the application is closed.