Android FirebaseUI resources problem

Hi,

I’m trying to create a game with firebase google and facebook login. I know that exists a way how to use firebase with unity, but I don’t want to create both login methods separately, when something like FirebaseUI exists.

So I’ve created android plugin with FirebaseUI authentication. I tested it in new android project and everything works fine. But when I use my plugin in unity, I have to add own gradle (mainTemplate.gradle) with dependencies for firebaseUI.

Problem is that there is a default value in firebase auth library and when the game is built, values from my library (default_web_client_id etc.) is overwritten by default value.

Almost after week I found a solution, but I hope there is another way.

My solution:
Build android library with firebase, copy library (.aar) to Assets/Plugins, export unity projekt with this library to Idea, then copy whole values.xml (that is created from google-services.json) and facebook appId to res folder in exported project. (then build from Idea)

It’s working, but by this method, I have default_web_client_id 3 times in projekt (1x from my library, 1x from FirebaseUI dependency and 1x from copied values.xml, that overrides them). It’s not a problem, but I think that it’s not necessary.

Is there any more elegant way how to work with android libraries?

Thanks

mainTemplate (dep part): 135259-maintemplatedep.png

Hi,

after some more experiments I found that it depends on implementation order, so I moved **DEPS** up and now its working.

So the solution is easy:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
**DEPS**
	def room_version = "1.1.1"

    implementation "android.arch.persistence.room:runtime:$room_version"
    annotationProcessor "android.arch.persistence.room:compiler:$room_version"
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'

    implementation "android.arch.lifecycle:extensions:1.1.1"
    implementation "android.arch.lifecycle:viewmodel:1.1.1"
    annotationProcessor "android.arch.lifecycle:compiler:1.1.1"

    implementation 'com.google.firebase:firebase-core:16.0.8'
    implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
    implementation 'com.facebook.android:facebook-android-sdk:4.41.0'
}

Hope that this helps somebody.