question

JassimAlRahma-9056 avatar image
0 Votes"
JassimAlRahma-9056 asked JarvanZhang-MSFT commented

Default constructor not found for type MyApp.IFirebaseEvents

Hi,

Why i am getting this when trying when trying to use Firebase Analytics with Xamarin Forms?

Default constructor not found for type MyApp.IFirebaseEvents

my interface is like this:

 using System;
 using System.Collections.Generic;
 using System.Text;
    
 namespace MyApp
 {
     public interface IFirebaseEvents
     {
         void LogEvent(string eventId);
         void LogEvent(string eventId, string paramName, string value);
         void LogEvent(string eventId, IDictionary<string, string> parameters);
         void ScreenView(string screen);
     }
 }



dotnet-csharpdotnet-xamarin
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi, JassimAlRahma-9056. Could you please post the related code about using the 'IFirebaseEvents'? Do you use DependencyService in your project? Pelase check the namespace of in implementation class on the native platform project.

[assembly: Xamarin.Forms.Dependency(typeof(Name Of Class))]
namespace TestApplication_6.Droid
{
    public class DroidImplementation : ITestInterface
    {
    }
}
0 Votes 0 ·

1 Answer

JohnHair avatar image
0 Votes"
JohnHair answered JohnHair commented

The error message implies you ar trying to use an interface like a class. Can you show where you are trying to use the interface?

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Here

 DependencyService.Get<IFirebaseEvents>().LogEvent("MainPage");


0 Votes 0 ·
JohnHair avatar image JohnHair JassimAlRahma-9056 ·

Can you share your implementation of that interface? The class that uses it.

0 Votes 0 ·