Itay2924
Itay2924

Reputation: 43

set up Firebasefirestore Xamarin.android error

recently i've been trying to set up a connection to my Firestore database. I followed the instructions given in this video only that there is a runtime exception when it tries to get the data base via GetDatabase()

 public static FirebaseFirestore GetDatabase()
        {
            FirebaseFirestore database;

            var app = Firebase.FirebaseApp.InitializeApp(Application.Context);
            if (app == null)
            {
                var options = new Firebase.FirebaseOptions.Builder()
               .SetProjectId("fulcrum-7c537")
               .SetApplicationId("fulcrum-7c537")
               .SetApiKey("AIzaSyA8lo7k0EFPNR32-g4xdBnMkQnycn_v4G8")
               .SetDatabaseUrl("https://fulcrum-7c537.firebaseio.com")
               .SetStorageBucket("fulcrum-7c537.appspot.com")
               .Build();

                app = Firebase.FirebaseApp.InitializeApp(Application.Context , options);
            }

            database = FirebaseFirestore.GetInstance(app);
            return database;
        }

The Exception :

Java.Lang.NoClassDefFoundError
Message=Failed resolution of: Lcom/google/common/io/BaseEncoding;

I have been trying for a while to find out why it happens but found nothing. May someone has a solution? Thanks!

Upvotes: 0

Views: 193

Answers (1)

Michal
Michal

Reputation: 11

I had exactly the same issue. I downloaded the code provided by Ufinix (the creator of the video). I downgraded the Xamarin.Google.Guava current version 28.2.0 I used, to the 27.1.0.1 version he used in his example. And finally, it worked.

Upvotes: 1

Related Questions