質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Firebase

Firebaseは、Googleが提供するBasSサービスの一つ。リアルタイム通知可能、並びにアクセス制御ができるオブジェクトデータベース機能を備えます。さらに認証機能、アプリケーションのログ解析機能などの利用も可能です。

Firebase Authentication

Firebase Authenticationは、Firebaseを利用したユーザーの認証機能です。バックエンドサービス、SDK、アプリでのユーザー認証に使用できるUIライブラリが用意されています。

Unity

Unityは、Unity Technologiesが開発・販売している、IDEを内蔵するゲームエンジンです。主にC#を用いたプログラミングでコンテンツの開発が可能です。

Q&A

1回答

1499閲覧

Exception: Field currentActivity or type signature not found

退会済みユーザー

退会済みユーザー

総合スコア0

Firebase

Firebaseは、Googleが提供するBasSサービスの一つ。リアルタイム通知可能、並びにアクセス制御ができるオブジェクトデータベース機能を備えます。さらに認証機能、アプリケーションのログ解析機能などの利用も可能です。

Firebase Authentication

Firebase Authenticationは、Firebaseを利用したユーザーの認証機能です。バックエンドサービス、SDK、アプリでのユーザー認証に使用できるUIライブラリが用意されています。

Unity

Unityは、Unity Technologiesが開発・販売している、IDEを内蔵するゲームエンジンです。主にC#を用いたプログラミングでコンテンツの開発が可能です。

0グッド

0クリップ

投稿2020/08/30 16:05

編集2022/01/12 10:55

前提・実現したいこと

UnityでのFirebaseのGoogleログイン認証を試みているのですが、

Exception: Field currentActivity or type signature not found

というエラーが出てしまいます。
対処法のご教示をお願い致します。

試したこと

Firebaseコンソールにて、Unity(Android対応)プロジェクトの作成を行いました。
Firebaseコンソールにて、Firebase Unity SDKをダウンロードして、下記をUnityプロジェクトにインポートしました。

・FirebaseAnalytics.unitypackage ・FirebaseAuth.unitypackage ・FirebaseDatabase.unitypackage

Firebaseコンソールにて、google-services.jsonをダウンロードしてUnityプロジェクトにインポートしました。
Unityプロジェクトにて、プラットフォームをAndroidに切り替えて、パッケージ名を設定しました。

Google Sing-in Unity PluginをUnityプロジェクトにインポートしました。
以下からダウンロードしてパッケージをインポートしました。

https://github.com/googlesamples/google-signin-unity/releases/tag/v1.0.4

下記ソースコードを空のオブジェクトにアタッチして組んだのですが、ゲーム実行時にエラーが発生してしまいました。
ゲーム実行前の状態では、コンソールにこのエラーは表示されません。

C#

1using System.Collections; 2using System.Collections.Generic; 3using UnityEngine; 4using System.Threading.Tasks; 5using Google; 6using Firebase; 7using Firebase.Auth; 8using Firebase.Database; 9//using Firebase.Unity.Editor; 10 11public class MyGoogleSignIn : MonoBehaviour 12{ 13 14 private FirebaseAuth auth; 15 private FirebaseUser user; 16 private string displayName; 17 private string emailAddress; 18 // private string photoUrl; 19 20 void Start() 21 { 22 23 InitializeFirebase(); 24 googleSignInButton(); 25 } 26 27 28 void InitializeFirebase() { 29 auth = Firebase.Auth.FirebaseAuth.DefaultInstance; 30 auth.StateChanged += AuthStateChanged; 31 AuthStateChanged(this, null); 32 } 33 34 void AuthStateChanged(object sender, System.EventArgs eventArgs) { 35 if (auth.CurrentUser != user) { 36 bool signedIn = user != auth.CurrentUser && auth.CurrentUser != null; 37 if (!signedIn && user != null) { 38 Debug.Log("Signed out " + user.UserId); 39 } 40 user = auth.CurrentUser; 41 if (signedIn) { 42 Debug.Log("Signed in " + user.UserId); 43 displayName = user.DisplayName ?? ""; 44 emailAddress = user.Email ?? ""; 45 // photoUrl = user.PhotoUrl ?? ""; 46 } 47 } 48 } 49 50 public void googleSignInButton() 51 { 52 GoogleSignIn.Configuration = new GoogleSignInConfiguration 53 { 54 RequestIdToken = true, 55 // Copy this value from the google-service.json file. 56 // oauth_client with type == 3 57 WebClientId = "318103883585-s7rfmu149ni9rhcrtt10ufrqi8oeshss.apps.googleusercontent.com" 58 }; 59 60 Task<GoogleSignInUser> signIn = GoogleSignIn.DefaultInstance.SignIn(); 61 62 TaskCompletionSource<FirebaseUser> signInCompleted = new TaskCompletionSource<FirebaseUser>(); 63 signIn.ContinueWith(task => 64 { 65 if (task.IsCanceled) 66 { 67 signInCompleted.SetCanceled(); 68 Debug.Log("canceled 1 " + user.UserId.ToString()); 69 } 70 else if (task.IsFaulted) 71 { 72 signInCompleted.SetException(task.Exception); 73 Debug.Log("is faulted 1 " + user.UserId.ToString()); 74 } 75 else 76 { 77 78 Credential credential = GoogleAuthProvider.GetCredential(task.Result.IdToken, null); 79 auth.SignInWithCredentialAsync(credential).ContinueWith(authTask => 80 { 81 if (authTask.IsCanceled) 82 { 83 signInCompleted.SetCanceled(); 84 Debug.Log("canceled " + user.UserId.ToString()); 85 } 86 else if (authTask.IsFaulted) 87 { 88 signInCompleted.SetException(authTask.Exception); 89 Debug.Log("is faulted " + user.UserId.ToString()); 90 } 91 else 92 { 93 signInCompleted.SetResult(authTask.Result); 94 Debug.Log("sign in " + user.UserId.ToString() + " " + user.DisplayName.ToString()); 95 } 96 }); 97 } 98 }); 99 } 100 101}
Exception: Field currentActivity or type signature not found

上記エラーメッセージで検索してみると、こちらの質問が見つかったのですが、
Android実機上でもゲーム画面に何も表示されませんでした(Googleログインが表示されませんでした)。
そもそも、Unityエディタ上の実行では、Googleログイン画面みたいなものは表示されないのでしょうか?

ちなみに、下記エラーもゲーム実行時に出るのですが、今回はAndroidでの実行を試みていて、コンソールのClearボタンをクリックすればエラーは消えるので、無視しています。

Assembly 'Assets/Firebase/Editor/Firebase.Editor.dll' will not be loaded due to errors: Unable to resolve reference 'UnityEditor.iOS.Extensions.Xcode'. Is the assembly missing or incompatible with the current platform? Reference validation can be disabled in the Plugin Inspector.

補足情報(FW/ツールのバージョンなど)

Unity 2020.1.2f1

###追記

Android Logcatでログをとったところ、Unityのログは以下でした。

Info Unity SystemInfo CPU = ARM64 FP ASIMD AES, Cores = 8, Memory = 1886mb Info Unity SystemInfo ARM big.LITTLE configuration: 4 big (mask: 0xf), 4 little (mask: 0xf0) Info Unity Built from '2020.1/staging' branch, Version '2020.1.2f1 (7b32bc54ba47)', Build type 'Release', Scripting Backend 'mono', CPU 'armeabi-v7a', Stripping 'Disabled' Debug Unity GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_EGL_sync GL_OES_vertex_half_float GL_OES_framebuffer_object GL_OES_rgb8_rgba8 GL_OES_compressed_ETC1_RGB8_texture GL_AMD_compressed_ATC_texture GL_KHR_texture_compression_astc_ldr GL_OES_texture_npot GL_EXT_texture_filter_anisotropic GL_EXT_texture_format_BGRA8888 GL_OES_texture_3D GL_EXT_color_buffer_float GL_EXT_color_buffer_half_float GL_QCOM_alpha_test GL_OES_depth24 GL_OES_packed_depth_stencil GL_OES_depth_texture GL_OES_depth_texture_cube_map GL_EXT_sRGB GL_OES_texture_float GL_OES_texture_float_linear GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_EXT_texture_type_2_10_10_10_REV GL_EXT_texture_sRGB_decode GL_OES_element_index_uint GL_EXT_copy_image GL_EXT_geometry_shader GL_EXT_tessellation_shader GL_OES_texture_stencil8 GL_EXT_shader_io_blocks GL_OES_shader_image_atomic GL_OES_sample_variables GL_EXT_texture_border_clamp GL_EXT_multisampled_render_to_texture GL_EXT_multisampled_render_to_texture2 GL_OES_shader_multisample_interpolation Debug Unity GL_EXT_texture_cube_map_array GL_EXT_draw_buffers_indexed GL_EXT_gpu_shader5 GL_EXT_robustness GL_EXT_texture_buffer GL_OES_texture_storage_multisample_2d_array GL_OES_sample_shading GL_OES_get_program_binary GL_EXT_debug_label GL_KHR_blend_equation_advanced GL_KHR_blend_equation_advanced_coherent GL_QCOM_tiled_rendering GL_ANDROID_extension_pack_es31a GL_EXT_primitive_bounding_box GL_OES_standard_derivatives GL_OES_vertex_array_object GL_EXT_disjoint_timer_query GL_KHR_debug GL_EXT_YUV_target GL_EXT_sRGB_write_control GL_EXT_texture_norm16 GL_EXT_discard_framebuffer GL_OES_surfaceless_context GL_OVR_multiview GL_OVR_multiview2 GL_EXT_texture_sRGB_R8 GL_KHR_no_error GL_EXT_debug_marker GL_OES_EGL_image_external_essl3 GL_OVR_multiview_multisampled_render_to_texture GL_EXT_buffer_storage GL_EXT_external_buffer GL_EXT_blit_framebuffer_params GL_EXT_shader_non_constant_global_initializers GL_QCOM_shader_framebuffer_fetch_noncoherent GL_EXT_memory_object GL_EXT_memory_object_fd GL_EXT_EGL_image_array GL_NV_shade Debug Unity r_noperspective_interpolation Error Unity InitializationException: Firebase app creation failed. Error Unity at Firebase.FirebaseApp.CreateAndTrack (Firebase.FirebaseApp+CreateDelegate createDelegate, Firebase.FirebaseApp existingProxy) [0x000e3] in <3245bcf598f64c448f2424c2c83e037f>:0 Error Unity at Firebase.FirebaseApp.Create () [0x00027] in <3245bcf598f64c448f2424c2c83e037f>:0 Error Unity at Firebase.FirebaseApp.get_DefaultInstance () [0x00017] in <3245bcf598f64c448f2424c2c83e037f>:0 Error Unity at Firebase.Auth.FirebaseAuth.get_DefaultInstance () [0x00000] in <a2091a50000d4b8fad83d8ecccc32a85>:0 Error Unity at MyGoogleSignIn.InitializeFirebase () [0x00000] in <ef1e66a7b65f407bb581c031198f0947>:0 Error Unity at MyGoogleSignIn.Start () [0x00000] in <ef1e66a7b65f407bb581c031198f0947>:0 Error Unity Error Unity (Filename: <3245bcf598f64c448f2424c2c83e037f> Line: 0) Error Unity Error Unity Failed to read Firebase options from the app's resources. Either make sure google-services.json is included in your build or specify options explicitly. Error Unity (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35) Error Unity

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

shiena

2020/08/31 19:12

実機のlogcatのエラーも載せてください。 Development BuildをチェックしてapkをビルドしてPackage ManagerのAdnroid Logcatで見るのが簡単です。使い方は以下のURLの通りでScripting Runtime Versionは変更しなくても動くはずです。 https://baba-s.hatenablog.com/entry/2018/12/25/090000
退会済みユーザー

退会済みユーザー

2020/09/02 09:20

ご指摘ありがとうございます。 Android Logcatのログを質問に追記致しました。
guest

回答1

0

Unityのバージョンが2020.1なのでこの対応が必要そうです。
unity 2020.1以降の環境下でfirebase on the android実機を動かす

また記事中のFirebaseのセットアップのページは日本語ではまだ載っていないので右上からEnglishに変更すると出てきます。
Missing Firebase Android config file in Unity 2020.

投稿2020/09/02 10:04

shiena

総合スコア1825

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

退会済みユーザー

退会済みユーザー

2020/09/02 14:52

ご回答ありがとうございます。 Firebase.androidlibにフォルダ名を変更して、 Build And Runを実行したら下記エラーが出てしまいました。 The minSdk version can not be specified in the AndroidManifest.xml file. You have to remove it.(See the Console for details) 只今、解決法を調べています。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問