Error descriptions
This is an archived version of documentation. You can find the current documentation for all platforms here.
The following sections describe common errors that you might encounter while working with the AppMetrica SDK on Android.
- Error when adding the library to a project
- Error initializing AppMetrica with third-party libraries
- Incorrect duration of user session during manual tracking
- 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.
Error initializing AppMetrica with third-party libraries
The code in the Application.onCreate()
method runs for all processes. If you encounter an initialization error after integrating a third-party library (such as Firebase Cloud Messaging), make sure that the third-party library is initialized only in the main process.
Error examples:
Unable to create application your.package.name.YourApp: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process your.package.name:Metrica. Make sure to call FirebaseApp.initializeApp(Context) first.
android.database.sqlite.SQLiteException: table httpauth already exists (code 1)
Fatal Exception: java.lang.RuntimeException: Using WebView from more than one process at once with the same data directory is not supported.
ANR at com.google.android.gms.ads.*
To fix the error, implement the main process check before initializing third-party libraries:
class MyApplication extends Application { @Override public void onCreate() { if (isMainProcess()) { // Initializing third-party libraries after verification. } } }
Copied to clipboard
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 considers that the session is active and commits regular data exchange 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 considers that the session is active and commits regular data exchange 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.