DrMoriarty / godot-firebase-analytics

Firebase Analytics plugin for Godot engine
17 stars 5 forks source link

Cannot get class 'FirebaseAnalytics'? #2

Closed oneseedfruit closed 3 years ago

oneseedfruit commented 3 years ago

Thanks for answering me previously!

So despite having installed the plugin via nativelib-cli and having "Firebase Analytics" enabled and is already in the autoload and enabled, when running it on Android, it can't find the "FirebaseAnalytics" class. What did I miss? Thanks again!

Screenshot_2021-02-19_18-43-52

oneseedfruit commented 3 years ago

I've also tried uninstalling it then reinstalling it via the nativelib-cli but it's still the same, it can't find the "FirebaseAnalytics" class.

DrMoriarty commented 3 years ago

Hi! Check if you enabled android platform on NativeLib window before installing plugin. Installed platforms shown as green icons in plugin view, available platforms - white icons.

oneseedfruit commented 3 years ago

Thanks for the swift response! I'm using nativelib-cli, is it possible to do this via the command line?

DrMoriarty commented 3 years ago
bash-3.2$ nativelib -l
Default platforms: all, android, ios

local-notification@0.1.1
  platforms: all, android, ios
oneseedfruit commented 3 years ago

Thanks!

Here's my output, looks like android is already enabled. The other plugins are all working, only the Firebase Analytics one isn't.

$ ../cmd/nativelib -l 
Default platforms: all, android, ios

nativelib-export@0.1.0
  platforms: all

firebase-core@0.1.0
  platforms: android

tenjin@0.1.0
  platforms: all, android

facebook@0.1.4
  platforms: all, android, ios

firebase-analytics@0.1.0
  platforms: all, android
DrMoriarty commented 3 years ago

Could you fetch application logs from the start? It seems that godot can not initialize plugin but I don't know why.

oneseedfruit commented 3 years ago

This one is from Godot.

log0.txt

This is from gradle.

manifest-merger-debug-report.txt

Did they help?

DrMoriarty commented 3 years ago

I mean from application start. You get logs of building and installation. Could you use AndroidStudio's debugger to get logs from device? Or can you use logcat to get logs?

oneseedfruit commented 3 years ago

This is from adb logcat -s godot

02-19 19:46:12.949   524   661 I godot   : Loading Android module: org/godotengine/godot/GodotFacebook
02-19 19:46:13.091   524   661 I godot   : Godot Engine v3.2.3.stable.official - https://godotengine.org
02-19 19:46:13.113   524   661 I godot   : OpenGL ES 3.0 Renderer: Adreno (TM) 506
02-19 19:46:13.154   524   661 I godot   :  
02-19 19:46:13.458   524   661 E godot   : **ERROR**: No library set for this platform
02-19 19:46:13.458   524   661 E godot   :    At: modules/gdnative/gdnative.cpp:290:initialize() - No library set for this platform
02-19 19:46:14.658   524   617 W godot   : No deferred app link
02-19 19:46:15.037   524   661 I godot   : Facebook plugin inited
02-19 19:46:15.057   524   661 I godot   : Tenjin plugin inited!
02-19 19:46:15.082   524   661 I godot   : Device GAID: e06764ba-0f10-464e-b29c-6e12e124be36
02-19 19:46:18.875   524   661 I godot   : GameLoader: loaded player_data! {avatar:5, bot_level:1, is_first_time:True, letters:{}}
02-19 19:46:18.891   524   524 I godot   : Sign in data is valid
02-19 19:46:18.891   524   524 I godot   : Using cached signin data
02-19 19:46:19.243   524   661 I godot   : Trying to load game from Google Play Games Services!
02-19 19:46:19.243   524   524 I godot   : Sign in data is valid
02-19 19:46:19.245   524   661 I godot   : Google Play Games Services: Sign in successful!
02-19 19:46:19.253   524   524 I godot   : Sign in data is valid
02-19 19:46:19.424   524   661 I godot   : {banner_image_landscape_url:https://lh3.googleusercontent.com/QwAdssB702cWAzuIYKRTM3dXRR4BzdHTm6pZ-Rmmq-6QJMZz2CuCbrGrObTmM4fGnmR6zekf7V7ZzRFf=s1411, banner_image_portrait_url:https://lh3.googleusercontent.com/4ncsLi9vb8c7MHH5i9A1-C1u8On3fT9ORaI7NJA5G0FpdQJ0g1oZ2wA6kVBtHTU4bucMCfB0C_c9jIRrGg=s1411, display_name:LostMyGrounds, hi_res_image_url:https://lh3.googleusercontent.com/cShOhrPhqSPCO7z3yyuEOxkD9Deq0tUP3mTjnTeGm6gU7ThBa28JHDxciZOsgA4R0WCH=s329-ns, icon_image_url:https://lh3.googleusercontent.com/cShOhrPhqSPCO7z3yyuEOxkD9Deq0tUP3mTjnTeGm6gU7ThBa28JHDxciZOsgA4R0WCH=s96-ns, level_info:{current_level:{level_number:17, max_xp:300000, min_xp:250000}, current_xp_total:265000, last_level_up_timestamp:1606252958304, next_level:{level_number:18, max_xp:350000, min_xp:300000}}, name:R T, player_id:g07630007087986321062, title:Superhero}
02-19 19:46:19.424   524   661 I godot   : Google Play Games Services: Player info successfully loaded!
02-19 19:46:20.210   524   661 I godot   : Google Play Games Services: Game successfully loaded! {}
DrMoriarty commented 3 years ago

I see that engine inited only two plugins: facebook and tenjin. Are you sure that you enabled analytics plugin?

oneseedfruit commented 3 years ago

Yeah, I have not seen "Firebase Analytics inited!" in the logs before too.

I already have these files in the android/plugins folder:


$ pwd
/home/username/r/0/Company/Game/source/android/plugins
# plugins git:main ● [^._.^]ノ彡ミ彡ミ
$ ls
FirebaseAnalytics.gdap         GodotPlayGamesServices.release.aar
FirebaseAnalytics.release.aar  Tenjin.gdap
GodotPlayGamesServices.gdap    Tenjin.release.aar
# plugins git:main ● [^._.^]ノ彡ミ彡ミ
$ 

I have the checkbox checked in the export settings:

Screenshot_2021-02-19_19-50-38

In export_presets.cfg, there are these lines:

[preset.0.options]

graphics/32_bits_framebuffer=true
xr_features/xr_mode=0
xr_features/degrees_of_freedom=0
xr_features/hand_tracking=0
xr_features/focus_awareness=false
one_click_deploy/clear_previous_install=false
custom_template/debug=""
custom_template/release=""
custom_template/use_custom_build=true
plugins/GodotPlayGamesServices=true
plugins/Tenjin=true
plugins/FirebaseAnalytics=true
command_line/extra_args=""
DrMoriarty commented 3 years ago

I think that I can guess what the problem do we have. Last time I updated plugin for godot 3.2.2 so now I'm going to rebuild it for 3.2.3.stable and will release it in some minutes.

oneseedfruit commented 3 years ago

Wow, thanks! As you've already seen from the logs, I've been using some of your plugins. Thanks for nativelib and these plugins! Keep up the good work. When I get my pay end of the month or early next month, I'll throw you some bucks!

DrMoriarty commented 3 years ago

:-) Check the new version 0.1.1

oneseedfruit commented 3 years ago

Firebase Analytics still doesn't init.

$ ../cmd/nativelib -l
Default platforms: all, android, ios

nativelib-export@0.1.0
  platforms: all

firebase-core@0.1.0
  platforms: android

tenjin@0.1.0
  platforms: all, android

facebook@0.1.4
  platforms: all, android, ios

firebase-analytics@0.1.1
  platforms: all, android
--------- beginning of system
02-19 20:23:28.572  6741  6841 I godot   : Loading Android module: org/godotengine/godot/GodotFacebook
02-19 20:23:28.710  6741  6841 I godot   : Godot Engine v3.2.3.stable.official - https://godotengine.org
02-19 20:23:28.730  6741  6841 I godot   : OpenGL ES 3.0 Renderer: Adreno (TM) 506
02-19 20:23:28.764  6741  6841 I godot   :  
02-19 20:23:29.148  6741  6841 E godot   : **ERROR**: No library set for this platform
02-19 20:23:29.149  6741  6841 E godot   :    At: modules/gdnative/gdnative.cpp:290:initialize() - No library set for this platform
02-19 20:23:29.565  6741  6824 W godot   : No deferred app link
02-19 20:23:30.791  6741  6841 I godot   : Facebook plugin inited
02-19 20:23:30.812  6741  6841 I godot   : Tenjin plugin inited!
02-19 20:23:30.838  6741  6841 I godot   : Device GAID: e06764ba-0f10-464e-b29c-6e12e124be36
02-19 20:23:34.877  6741  6841 I godot   : GameLoader: loaded player_data! {avatar:5, bot_level:1, is_first_time:True, letters:{}}
02-19 20:23:34.897  6741  6741 I godot   : Sign in data is valid
02-19 20:23:34.897  6741  6741 I godot   : Using cached signin data
02-19 20:23:35.245  6741  6841 I godot   : Trying to load game from Google Play Games Services!
02-19 20:23:35.245  6741  6741 I godot   : Sign in data is valid
02-19 20:23:35.247  6741  6841 I godot   : Google Play Games Services: Sign in successful!
02-19 20:23:35.257  6741  6741 I godot   : Sign in data is valid
02-19 20:23:35.398  6741  6841 I godot   : {banner_image_landscape_url:https://lh3.googleusercontent.com/QwAdssB702cWAzuIYKRTM3dXRR4BzdHTm6pZ-Rmmq-6QJMZz2CuCbrGrObTmM4fGnmR6zekf7V7ZzRFf=s1411, banner_image_portrait_url:https://lh3.googleusercontent.com/4ncsLi9vb8c7MHH5i9A1-C1u8On3fT9ORaI7NJA5G0FpdQJ0g1oZ2wA6kVBtHTU4bucMCfB0C_c9jIRrGg=s1411, display_name:LostMyGrounds, hi_res_image_url:https://lh3.googleusercontent.com/cShOhrPhqSPCO7z3yyuEOxkD9Deq0tUP3mTjnTeGm6gU7ThBa28JHDxciZOsgA4R0WCH=s329-ns, icon_image_url:https://lh3.googleusercontent.com/cShOhrPhqSPCO7z3yyuEOxkD9Deq0tUP3mTjnTeGm6gU7ThBa28JHDxciZOsgA4R0WCH=s96-ns, level_info:{current_level:{level_number:17, max_xp:300000, min_xp:250000}, current_xp_total:265000, last_level_up_timestamp:1606252958304, next_level:{level_number:18, max_xp:350000, min_xp:300000}}, name:R T, player_id:g07630007087986321062, title:Superhero}
02-19 20:23:35.398  6741  6841 I godot   : Google Play Games Services: Player info successfully loaded!
02-19 20:23:37.735  6741  6841 I godot   : Google Play Games Services: Game successfully loaded! {}
DrMoriarty commented 3 years ago

Could you get me your APK file?

oneseedfruit commented 3 years ago

https://www.dropbox.com/s/t3bm2zy5sale8tj/game.apk?dl=0 I've uploaded it here.

DrMoriarty commented 3 years ago

Could you check your Firebase Analytics dashboard, if it show any activity? As far as I can see Firebase Analytics now inited and worked (your apk logs): Снимок экрана 2021-02-19 в 15 59 44 I only now noticed that in gd wrapper no success initialization output as in other plugins. You can add this and check:

func _ready():
    if type_exists('FirebaseAnalytics'):
        _fba = ClassDB.instance('FirebaseAnalytics')
        print("FirebaseAnalytics inited!")   # <- add this
oneseedfruit commented 3 years ago

There is activity in my dashboard but only for "Users in the last 30 minutes".

Screenshot_2021-02-19 Squabble – Dashboard – Firebase console

I added that line but there is no output in the log.

Seems like the plugin is active but cannot be called from GDScript. So, events are not logged.

02-19 21:36:23.444 21884 22001 I godot   : Loading Android module: org/godotengine/godot/GodotFacebook
02-19 21:36:23.591 21884 22001 I godot   : Godot Engine v3.2.3.stable.official - https://godotengine.org
02-19 21:36:23.603 21884 22001 I godot   : OpenGL ES 3.0 Renderer: Adreno (TM) 506
02-19 21:36:23.637 21884 22001 I godot   :  
02-19 21:36:23.994 21884 22001 E godot   : **ERROR**: No library set for this platform
02-19 21:36:23.994 21884 22001 E godot   :    At: modules/gdnative/gdnative.cpp:290:initialize() - No library set for this platform
02-19 21:36:25.099 21884 21973 W godot   : No deferred app link
02-19 21:36:25.628 21884 22001 I godot   : Facebook plugin inited
02-19 21:36:25.647 21884 22001 I godot   : Tenjin plugin inited!
02-19 21:36:25.669 21884 22001 I godot   : Device GAID: e06764ba-0f10-464e-b29c-6e12e124be36
02-19 21:36:29.656 21884 22001 I godot   : GameLoader: loaded player_data! {avatar:5, bot_level:1, is_first_time:True, letters:{}}
02-19 21:36:29.671 21884 21884 I godot   : Sign in data is valid
02-19 21:36:29.671 21884 21884 I godot   : Using cached signin data
02-19 21:36:30.023 21884 22001 I godot   : Trying to load game from Google Play Games Services!
02-19 21:36:30.023 21884 21884 I godot   : Sign in data is valid
02-19 21:36:30.024 21884 22001 I godot   : Google Play Games Services: Sign in successful!
02-19 21:36:30.032 21884 21884 I godot   : Sign in data is valid
02-19 21:36:30.317 21884 22001 I godot   : Google Play Games Services: Player info successfully loaded!
02-19 21:36:32.353 21884 22001 I godot   : Google Play Games Services: Game successfully loaded! {}

Screenshot_2021-02-19_21-40-57

DrMoriarty commented 3 years ago

Stupid mistake in the wrapper. It seems that I wrote this late Friday night. It should be:

func _ready():
    if(Engine.has_singleton("FirebaseAnalytics")):
        _fba = Engine.get_singleton("FirebaseAnalytics")
        print('FirebaseAnalytics plugin inited!')
    elif type_exists('FirebaseAnalytics'):
        _fba = ClassDB.instance('FirebaseAnalytics')
        print('FirebaseAnalytics plugin inited!')
oneseedfruit commented 3 years ago

Ahh, I was wondering why wasn't it Engine.has_singleton() when the other plugins have been using it, but I didn't think too much of it.

Haha, it's working perfectly now!!

The event that I logged finally appears in adb logcat -v time -s FA FA-SVC

02-19 21:52:44.214 V/FA-SVC  (18512): Logging event: origin=app,name=login,params=Bundle[{locale=en_GB, screen_dpi=280, ga_event_origin(_o)=app, ga_screen_class(_sc)=GodotApp, ga_screen_id(_si)=-6365433143646965290, time={month=2, dst=false, hour=21, year=2021, weekday=5, day=19, minute=52, second=44}}]

After changing the code in _ready()

Screenshot_2021-02-19_21-55-52

You're a lifesaver, thank you for everything!!! Keep up the awesome work!!!

DrMoriarty commented 3 years ago

Published new plugin version 0.1.2 with all changes

oneseedfruit commented 3 years ago

Thanks!!! I'm very grateful!!!