firebase / firebase-unity-sdk

The Firebase SDK for Unity
http://firebase.google.com
Apache License 2.0
216 stars 35 forks source link

[Bug] Firebase for Unity v10.0.1 Cannot run on Android Platform in Editor Mode! #506

Closed CodeMasterYi closed 1 year ago

CodeMasterYi commented 1 year ago

[REQUIRED] Please fill in the following fields:

[REQUIRED] Please describe the issue here:

When run in editor mode with switched to Android Platform, FirebaseApp cannot be construct staticly! See the following log:

DllNotFoundException: FirebaseCppApp-10_0_1 assembly: type: member:(null)
DllNotFoundException: FirebaseCppApp-10_0_1 assembly:<unknown assembly> type:<unknown type> member:(null)
Firebase.AppUtilPINVOKE+SWIGExceptionHelper..cctor () (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/android_unity/armeabi-v7a/app/swig/Firebase.App_fixed.cs:3916)
Rethrow as TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception.
Firebase.AppUtilPINVOKE..cctor () (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/android_unity/armeabi-v7a/app/swig/Firebase.App_fixed.cs:3936)
Rethrow as TypeInitializationException: The type initializer for 'Firebase.AppUtilPINVOKE' threw an exception.
Firebase.AppUtil.SetLogFunction (Firebase.LogUtil+LogMessageDelegate arg0) (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/android_unity/armeabi-v7a/app/swig/Firebase.App_fixed.cs:4646)
Firebase.LogUtil..ctor () (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/src/LogUtil.cs:81)
Firebase.LogUtil..cctor () (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/src/LogUtil.cs:37)
Rethrow as TypeInitializationException: The type initializer for 'Firebase.LogUtil' threw an exception.
Firebase.FirebaseApp..cctor () (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/android_unity/armeabi-v7a/app/swig/Firebase.App_fixed.cs:1897)
Rethrow as TypeInitializationException: The type initializer for 'Firebase.FirebaseApp' threw an exception.
Pluto.LiteGame.Firebase.FirebaseInit.Awake () (at Assets/Scripts/Firebase/FirebaseInit.cs:27)
UnityEngine.Object:Instantiate(GameObject, Transform)
<InitDelayPrefabs>d__46:MoveNext() (at Assets/Scripts/UI/Common/AZ_GameInitLoading.cs:258)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr) (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/Coroutines.cs:17)

In the log, we can find firebase-unity-sdk/android_unity/armeabi-v7a/app/swig, it is an android implement? why you use android implement in Editor mode? why not use an eiditor implement?

Due to this issue, I cannot use FirebaseApp anytime in Editor mode with Android Platform.

(Please list the full steps to reproduce the issue. Include device logs, Unity logs, and stack traces if available.)

Steps to reproduce:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)? What's the issue repro rate? (eg 100%, 1/5 etc)

What happened? How can we make the problem occur? This could be a description, log/console output, etc.

If you have a downloadable sample project that reproduces the bug you're reporting, you will likely receive a faster response on your issue.

Relevant Code:

// TODO(you): code here to reproduce the problem
AlmostMatt commented 1 year ago

It looks like this is a duplicate of #449 I'll close this issue in order to keep the discussion together in #449

AlmostMatt commented 1 year ago

Reopening because as mentioned in https://github.com/firebase/firebase-unity-sdk/issues/449#issuecomment-1297966811, the other issue #449 mentioned docker containers or other context that does not apply here, so this is potentially a separate issue.

a-maurice commented 1 year ago

Ah, so there is a bit of confusion here. There are two main files for each library, one for C# and one for C++. C++ have a different version of the library for each platform, but C# has only two versions, one for iOS and one for everything else (the difference is whaat type of dllimport statement it uses, as described here: https://docs.unity3d.com/2021.1/Documentation/Manual/NativePlugins.html)

This is why it is using the "Android" version of the C# library, but it should work for the editor as well.

As for the issue you are seeing, there are a bunch of different reasons that the dll could not be found. It should be looking for Firebase/Plugins/x86_64/FirebaseCppApp-10_0_1.bundle, so can you confirm that the file is there, and the editor settings indicate it is being linked correctly.

Another issue that can come up on Mac is the security and privacy settings. Here is a video that covers the issue: https://www.youtube.com/watch?v=1DeG51P7BBc

Can you check that file, and make sure it seems correct?

CodeMasterYi commented 1 year ago

FirebaseBundle This is what I can see on my Mac. Is it right? I am sure it is not be deleted. If I reimport the .unitypackage file of the SDK, I have nothing new to import.

sunjiakungithub commented 1 year ago

Has the problem been solved

CodeMasterYi commented 1 year ago

Has the problem been solved

I dont think so.

sunjiakungithub commented 1 year ago

That's too bad. I have the same problem. I can't get into the project

CodeMasterYi commented 1 year ago

That's too bad. I have the same problem. I can't get into the project

Comment them in editor mode. using "#if define UNITY_EDITOR".

DellaBitta commented 1 year ago

Hi @CodeMasterYi,

Unfortunately we can't seem to reproduce this issue with our standard quickstarts. The only thing that comes to mind is that the macOS security machanisms have blocked Unity's use of the Firebase Unity Package .dll files. Could you start with a fresh project and attempt to re-import the Firebase Unity Packages and note any and all windows that appear during the installation of the Firebase packages and the execution of the build on your machine?

Thanks!

sunjiakungithub commented 1 year ago

The cause of this problem is the lack of a C++ compilation environment,Part of FirebaseDll is written in C++,Just install VS

CodeMasterYi commented 1 year ago

The cause of this problem is the lack of a C++ compilation environment,Part of FirebaseDll is written in C++,Just install VS

@sunjiakungithub Don't you see the word Mac?

mgrogin commented 1 year ago

I think the issue I'm having is the same issue. I think it has to do with mac Security & Privacy blocking it but not sure

more details here: https://github.com/firebase/firebase-unity-sdk/issues/510#issuecomment-1315098229

google-oss-bot commented 1 year ago

Hey @CodeMasterYi. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot commented 1 year ago

Since there haven't been any recent updates here, I am going to close this issue.

@CodeMasterYi if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.