Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firebase incompatible with Google Play Games #70

Closed
ghost opened this issue Mar 16, 2017 · 6 comments
Closed

Firebase incompatible with Google Play Games #70

ghost opened this issue Mar 16, 2017 · 6 comments

Comments

@ghost
Copy link

ghost commented Mar 16, 2017

Hi.
I'm trying to integrate Firebase Messaging in a project that uses the Google Play Games plugin.

I used the messaging testapp, and I added the official FirebaseMessaging.unitypackage from the 3.0.1 zip file.
I then added GooglePlayGamesPlugin-0.9.36.unitypackage from the official github repo.
I let the Play Services Resolver automatically pull the right google-play libraries (currently 1.2.0).
I edited the UIHandler.cs script adding only PlayGamesPlatform.Activate (); and Social.localUser.Authenticate (OnAuthenticate); in the Start() function.

When the app stasts, it crashes giving me this error:
GamesNativeSDK: Exception in dalvik/system/DexClassLoader.loadClass: java.lang.IncompatibleClassChangeError: Class com.google.android.gms.games.NativeSdkCallbacks implements non-interface class com.google.android.gms.nearby.connection.Connections$ConnectionRequestListener (declaration of 'com.google.android.gms.games.NativeSdkCallbacks' appears in /data/user/0/com.testproject.testgame/app_.gpg.classloader/d75c8e1bbeab9e1ddffb9d332585db71.jar).

If I disable the Play Services Resolver, and manually downgrade the google-play libraries to 10.0.1, I get this error:
AndroidRuntime: java.lang.NoSuchMethodError: No static method zzdz(Ljava/lang/String;)Z in class Lcom/google/android/gms/common/util/zzw; or its super classes (declaration of 'com.google.android.gms.common.util.zzw' appears in /data/app/com.testproject.testgame-1/base.apk)

Is there any workaround or solution to the problem?

@johnb003
Copy link

This is a known problem which we're working on.
You were on the right track with the work-around, by downgrading to < 10.2.

Did you downgrade all packages to the same version? You can't mix and match them.

@ghost
Copy link
Author

ghost commented Mar 17, 2017

I have downgraded all play-services-*.aar packages in the Assets/Plugins/Android directory.
After reading your comment, I downgraded also firebase-messaging-10.0.1.aar (by getting the aar directly from the repo) and firebase-common-10.0.1 and firebase-iid-10.0.1 (by extracting the contents of the aars I got from the repo)
I get this error:

firebase: Java class com/google/firebase/FirebaseApp not found. Please verify the AAR which contains the com/google/firebase/FirebaseApp class is included in your app.

@johnb003
Copy link

It sounds like you're now missing the dependencies.

How are you downgrading? You might want to set the version in the "*deps.cs" files, and you'll still need to use the android jar resolver.

@ghost
Copy link
Author

ghost commented Mar 20, 2017

I tried to manually set the version in all the "*deps.cs" files. Now the resolver correctly resolves to 10.0.1 on every dependency in the Assets/Plugins/Android directory. If I execute the quickstart project Firebase Messaging works flawlessly.
On the other hand, when I try to integrate this whole process to the production project I'm working on, I get this error:

03-20 17:05:09.749  7363  7384 I Unity   : NullReferenceException: Object reference not set to an instance of an object
03-20 17:05:09.749  7363  7384 I Unity   :   at Firebase.Internal.InstallRootCerts.InstallDefaultCRLs (System.String resource_name, System.String directory) [0x00000] in <filename unknown>:0 
03-20 17:05:09.749  7363  7384 I Unity   :   at Firebase.Internal.InstallRootCerts.Process (Firebase.FirebaseApp app) [0x00000] in <filename unknown>:0 
03-20 17:05:09.749  7363  7384 I Unity   :   at Firebase.FirebaseApp.CreateAndTrack (Firebase.CreateDelegate createDelegate) [0x00000] in <filename unknown>:0 
03-20 17:05:09.749  7363  7384 I Unity   :   at Firebase.FirebaseApp.Create () [0x00000] in <filename unknown>:0 
03-20 17:05:09.749  7363  7384 I Unity   :   at Firebase.FirebaseApp.get_DefaultInstance () [0x00000] in <filename unknown>:0 
03-20 17:05:09.749  7363  7384 I Unity   :   at Firebase.Messaging.FirebaseMessaging Listener..ctor () [0x00000] in <filename unknown>:0 
03-20 17:05:09.749  7363  7384 I Unity   :   at Firebase.Messaging.FirebaseMessaging Listener.Create () [0x00000] in <filename unknown>:0 
03-20 17:05:09.749  7363  7384 I Unity   :   at Firebase.Messaging.FirebaseMessaging..cctor () [0x00000] in <filename unknown>:0 
03-20 17:05:09.749  7363  7384 I Unity   : Rethrow as TypeInitializationException: An exception was thrown by the type initializer for Firebase.Messaging.FirebaseMessaging

My best guess is that it's happening during the execution of the Firebase.Messaging.FirebaseMessaging.TokenReceived callback.
If you think it's an unrelated issue, I'll close this one.
Thanks.

@johnb003
Copy link

Did you follow the instructions for setting up your app on the firebase console?
https://firebase.google.com/docs/unity/setup

I'd especially double check the part about setting up your SHA certificate:
https://developers.google.com/android/guides/client-auth

@ghost
Copy link
Author

ghost commented Mar 22, 2017

Thanks for your advice. The issue is now solved.
Here are some further details on how to workoround this issue:

  • When downgrading the dependencies, most of them are declared in the "*deps.cs" files, but depending on what other plugin you use, they may be declared somewhere else. Searching for the string "VersionHandler" in the whole project will find everytime the Resolver is being used.

  • The certificate issue can be solved in "Player Settings -> Other settings" by setting "Stripping Level" to "Disabled".

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants