When you specify in the manifest android:name=".MyApp" , the application does not even open ... here is the MyApp code

  package com.example.app; import com.yandex.metrica.YandexMetrica; public class MyApp extends android.app.Application { @Override public void onCreate() { super.onCreate(); // Initialize Yandex Metrica YandexMetrica.initialize(this, Stuff.APP_API_KEY); } } 

UPD here is Androidmanifest

  <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.example.app" android:versionCode="1" android:installLocation="preferExternal" android:versionName="1.0"> <!-- Yandex Metrica required permission. Open network sockets --> <uses-permission android:name="android.permission.INTERNET"/> <!-- Yandex Metrica required permission. Access information about networks --> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <!-- Yandex Metrica optional permission. Approximate location derived from network location sources such as cell towers and Wi-Fi --> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <!-- Yandex Metrica optional permission. Precise location from location sources such as GPS, cell towers, and Wi-Fi --> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <!-- Yandex Metrica optional permission. Wifi state: mac, ssid, ... --> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> <uses-sdk android:minSdkVersion="14"/> <application android:name="MyApp" android:label="@string/app_name" android:icon="@drawable/logo1" > <service android:name="com.yandex.metrica.MetricaService" android:enabled="true" android:exported="true" android:process=":Metrica" tools:ignore="ExportedService"> <intent-filter> <category android:name="android.intent.category.DEFAULT"/> <action android:name="com.yandex.metrica.IMetricaService"/> <data android:scheme="metrica"/> </intent-filter> <meta-data android:name="metrica:api:level" android:value="16"/> </service> <receiver android:name="com.yandex.metrica.MetricaEventHandler" android:enabled="true" android:exported="true" tools:ignore="ExportedReceiver"> <intent-filter> <action android:name="com.yandex.metrica.intent.action.SYNC"/> </intent-filter> <intent-filter> <action android:name="android.intent.action.PACKAGE_ADDED"/> <action android:name="android.intent.action.PACKAGE_DATA_CLEARED"/> <data android:scheme="package"/> </intent-filter> <intent-filter> <action android:name="com.android.vending.INSTALL_REFERRER"/> </intent-filter> </receiver> <provider android:name="com.example.world_train.MetricaContentProvider" android:authorities="com.yandex.sample.metrica.MetricaContentProvider" android:enabled="true" android:exported="true" tools:ignore="ExportedContentProvider"/> <!-- Yandex Metrica required manifest entries END --> <activity android:name="MainActivity" android:label="@string/app_name" android:configChanges="orientation|screenSize|keyboardHidden"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name=".ScreenOneActivity"/> <activity android:name=".ScreenOne"/> <activity android:name=".ScreenTwo"/> <activity android:name=".ScreenThree"/> <activity android:name=".ScreenFour"/> <activity android:name=".ScreenFourAbout"/> <activity android:name=".ScreenFourContacts"/> </application> </manifest> 
  • Open logcat see logs. Without it, nothing is clear. - VladimirAbramov
  • And what does the log write? probably some sort of Exception! - arg
  • in the log it is empty, if in debug mode ... - DenShDen
  • The day before yesterday I connected YM and everything started working from the first time ... - Yuriy SPb
  • one
    @DenShDen, yes did the official. manual. Check the manifest tag. Your package must be listed there. MyApp class should be in this package. And in the Application tag of the manifest, remove the point before MyApp - Yuriy SPb

2 answers 2

Try to change

 <provider android:name="com.example.world_train.MetricaContentProvider" android:authorities="com.yandex.sample.metrica.MetricaContentProvider" 

on:

 <provider android:name="com.example.app.MetricaContentProvider" android:authorities="com.example.app.MetricaContentProvider" 

by moving the MetricaContentProvider class to the com.example.app package

  • Nene, not this, I just did not emphasize this, I changed it all to the app (about the world train), but gro Yandex yes, now it will be - DenShDen
  • one
    I did not understand a single word from your commentary ... Read man again and do everything from scratch ... - YuriySPb
  • Everything works, thank you very much)) I’ve been digging this trifling mistake of the day 3 ... Thank you very much ... again .._)) - DenShDen
  • 2
    @DenShDen, if my answer was correct, then besides “thank you,” you still need to vote for it and accept it) - Yuriy SPb

Add

 @Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); MultiDex.install(this); } 

in class MyApp

  • Try to write more detailed answers. Explain what is the basis of your statement? - Nicolas Chabanovsky