problems with the Application

When you specify android:name=".MyApp" in the manifest, the application doesn't 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>
Author: ЮрийСПб, 2015-04-08

2 answers

Try changing the

<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

 1
Author: ЮрийСПб, 2015-04-08 19:49:56

Add

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

To the MyApp{[2] class]}

 -1
Author: Volodymyr Machekhin, 2016-04-04 05:35:50