4

I'm trying to run my app on the device but it crashes on the first activity. It's Login Activity and it seems like my app simply can't connect to the Firebase and it causes a problem. Logcat says:

E/FirebaseInstanceId: Failed to resolve target intent service, skipping classname enforcement
E/FirebaseInstanceId: Error while delivering the message: ServiceIntent not found.

I've googled a lot and it seems like the problem is with manifest file. I tried copy-pasting lots of things there but nothing works. Here is my manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.elise.besafe">

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="Bincle"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <service android:name="com.google.android.gms.measurement.AppMeasurementService"
            android:enabled="true"
            android:exported="false"/>

        <receiver android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
            android:enabled="true">
            <intent-filter>
                <action android:name="com.google.android.gms.measurement.UPLOAD" />
            </intent-filter>
        </receiver>

        <activity android:name="activities.LoginActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="activities.RegisterActivity" />
        <activity
            android:name="activities.ProfileVolunteerActivity"
            android:label="@string/title_activity_profile_volunteer"
            android:theme="@style/AppTheme.NoActionBar" />
        <activity
            android:name="activities.ProfileDisabledActivity"
            android:label="@string/title_activity_profile_disabled"
            android:theme="@style/AppTheme.NoActionBar" />
        <activity android:name="activities.RegisterDisabledActivity" />
        <activity
            android:name="activities.GetHelpActivity"
            android:label="@string/title_activity_get_help"
            android:theme="@style/AppTheme.NoActionBar" />
        <activity
            android:name="activities.BasicDisActivity"
            android:label="@string/title_activity_basic_dis"
            android:theme="@style/AppTheme.NoActionBar" />
        <activity android:name="activities.HelpSbActivity" />
        <activity android:name="activities.PointsActivity"> />
    </application>

</manifest>
Adil Soomro
  • 37,609
  • 9
  • 103
  • 153
Svitlana
  • 53
  • 1
  • 4

1 Answers1

1

In my case I resolved it by putting this properties in the onCreate part:

    setContentView(R.layout.activity_main);

    FirebaseOptions.Builder builder = new FirebaseOptions.Builder()
        .setApplicationId(1:0123456789012:android:0123456789abcdef")
        .setApiKey("your_api_key")
        .setDatabaseUrl("https://your-app.firebaseio.com")
        .setStorageBucket("your-app.appspot.com");

    FirebaseApp.initializeApp(this, builder.build());

I use too strings file to every key, example:

   (String.valueOf(R.string.setApplicationId))

The properties or keys can be found on your Json google-services file or directly from the firebase console. Hope I help.

Mini Cisne
  • 41
  • 1