Unable to instantiate service, Didn't find class on path: DexPathList

JacobSteeleJacobSteele USMember ✭✭
edited June 2018 in Xamarin.Android

Hey Xamarin,

I am currently getting an error when trying to deploy my app to my test device.

Unhandled Exception:

Java.Lang.RuntimeException: Unable to instantiate service com.testApp.FCMTest.MyFirebaseIIDService: java.lang.ClassNotFoundException: Didn't find class "com.testApp.FCMTest.MyFirebaseIIDService" on path: DexPathList[[zip file "/data/app/com.testApp.FCMTest-1/base.apk"],nativeLibraryDirectories=[/data/app/com.testApp.FCMTest-1/lib/arm64, /system/fake-libs64, /data/app/com.testApp.FCMTest-1/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]] occurred

My service looks like

using System;
using Android.App;
using Firebase.Iid;
using Android.Util;

namespace Chat.Droid
{ 
    [Service]
    [IntentFilter(new[] { "com.google.firebase.INSTANCE_ID_EVENT" })]
    public class MyFirebaseIIDService : FirebaseInstanceIdService
    {
        const string TAG = "MyFirebaseIIDService";
        public override void OnTokenRefresh()
        {
            var refreshedToken = FirebaseInstanceId.Instance.Token;
            Log.Debug(TAG, "Refreshed token: " + refreshedToken);
            SendRegistrationToServer(refreshedToken);
        }
        void SendRegistrationToServer(string token)
        {
            // Add custom implementation, as needed.
        }
    }
}

And the entry in my manifest is,

    <service android:name=".MyFirebaseIIDService">
        <intent-filter>
            <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
        </intent-filter>
    </service>

Does anyone have any ideas?

I have linking set to None, I have ProGuard off, and Multi-Dex off. Testing on a Nexus 6P

Best Answer

  • JacobSteeleJacobSteele US ✭✭
    Accepted Answer

    Turns out I didn't need to add it to manifest. So this answer can be closed as it works without the manifest entry.

Answers

  • JacobSteeleJacobSteele USMember ✭✭
    Accepted Answer

    Turns out I didn't need to add it to manifest. So this answer can be closed as it works without the manifest entry.

Sign In or Register to comment.