dimanche 5 février 2017

Create library without package dependency using Firebase Android SDK

Since we keep switching our backend depedencies (Previously parse, then backendless now firebase), I am trying to create a backend library for all my projects with adapters for specific backends and common interface to be used in the projects (Adapter Design pattern).

For example,

The backend library interface will have method,

save(User user)

and the adapters will have implementation to save the User in firebase or backendless, and I can easily switch

But the way the firebase sdk works, we need to have 'google-services.json' in our path with predefined 'package name', otherwise we would get the following error in gradle build,

Execution failed for task ':backend:processReleaseGoogleServices'. No matching client found for package name 'com.lib.backend'

The error is obvious, as the google-services.json would have the packagename of the specific project.

So now is there a way or a procedure I could follow, where my projects will not use the 'Firebase' classes directly and it works only through the 'backend' library.

Aucun commentaire:

Enregistrer un commentaire