DrMoriarty / godot-facebook

Facebook module for Godot Game Engine (android and iOS)
MIT License
81 stars 23 forks source link

Android - plugin not running #18

Closed kjav closed 3 years ago

kjav commented 3 years ago

Hi, I've been trying to install this plugin, however so far I cannot get the plugin to initialise properly on Android. This is the error I get: **Warning**: Facebook plugin not found! I installed the plugin via nativelib from the asset store. I put in a valid facebook app ID code, and clicked the switch "Enable Android for project" at the top of the NativeLib ui. I've also enabled "use custom build" in the export template. However I still see this error when I run the game on Android. Do you have any ideas of where I might have gone wrong, and how I can debug this issue? Thanks!

kjav commented 3 years ago

I forgot to mention - I'm using the editor version 3.2.2-stable. However I have replicated the issue in Godot 3.2.3-stable.

DrMoriarty commented 3 years ago

Hi @kjav check if you enabled Android platform on NativeLib view on the top. If not you should enable it and reinstall plugin.

kjav commented 3 years ago

Hi, thanks for the reply! I have tried that already - uninstalling, ensuring the android switch is switched, and then reinstalling the plugin. Unfortunately it didn't fix the issue. Do you have any more advice for debugging this? Is there a video somewhere showing the whole process of adding this plugin? Thanks for the help.

DrMoriarty commented 3 years ago

I didn't recorded video for installation process but it may be a good idea. Also check if plugin's checkbox enabled in your export settings. Снимок экрана 2021-04-19 в 12 40 56

kjav commented 3 years ago

Ah, this seems like it is getting to my issue now! I don't have a plugins section in my export settings in the editor. Is that something that should be added by NativeLib, or is it because of the version I'm using (3.2.3)?

git_capture

DrMoriarty commented 3 years ago

New andoroid plugin system was implemented in 3.2.2 and all my plugins should be compatible with 3.2.2. So it is not a version issue. Check if you installed Nativelib-Export plugin and if it enabled. Снимок экрана 2021-04-19 в 13 08 13

kjav commented 3 years ago

Hmm, the android/plugins directory is empty, and according to the docs this is where the plugins section of the export settings is generated from? Here are my settings: plugin1 (I installed after switching on 'Android' at the top, and the ID field is usually filled in but blanked out here for privacy) plugin2 plugin3 Maybe I need to delete all of the files and start over, as initially I didn't switch on 'Android' in NativeLib before installing facebook. Do you think that would help?

DrMoriarty commented 3 years ago

The facebook plugin uses some hacks to compile so it is in android/facebook folder but not in android/plugins.

kjav commented 3 years ago

Hmm, so shouldn't it still show up in the plugins section of the android export window? This documentation seems to suggest there will be a '.gdap' file somewhere but I can't find it in the android/facebook/ directory: $ dir android/facebook/ AndroidManifest.conf AndroidManifestChunk.xml gradle.conf res/ src/ Thanks for all your help so far.

kjav commented 3 years ago

In fact I have just confirmed that installing another plugin (GameAnalytics) does show up in the Plugins section of the export templates. So the problem does appear to be with the Facebook plugin (or how I'm using it!)

DrMoriarty commented 3 years ago

I was wrong, the facebook plugin should not appear in export window (I forgot about that). It injects singleton class during custom compilation and therefore it has no gdap file.

kjav commented 3 years ago

I see, thanks. Is there any other reason why I should be recieving this errors then? I believe I have all of the settings correct in my project.

kjav commented 3 years ago

I've just tried going through all the steps again, and noticed this error when installing the facebook plugin:

Installing facebook@0.1.6
  Unpack facebook_0.1.6_all.tgz
  Unpack facebook_0.1.6_android.tgz

 core/image.cpp:1604 - Index p_width - 1 = -1 is out of bounds (MAX_WIDTH = 16384).
 Width of image must be greater than 0.
 core/image.cpp:2390 - Condition "data.size() == 0" is true.
 drivers/png/png_driver_common.cpp:56 - png_image_write_to_memory: invalid argument
 drivers/png/png_driver_common.cpp:183 - Condition "compressed_size <= png_size_estimate" is true. Returned: FAILED
 Can't convert image to PNG.
Add: res:C:/Users/<>/git/nl/godot/BobaCup/android/facebook/res

I also tried the steps in an empty project, and didn't recieve this error. Is there a particular image this library is accessing in the project (e.g. icon.png) which I should be careful to include? Thanks!

DrMoriarty commented 3 years ago

It is very strange because android/facebook/res should not contain any png images. It only contains one xml file with FB App ID.

kjav commented 3 years ago

OK, I think the png error was a red herring - sorry! Must have been a poorly timed error coming from somewhere else in the project.

I think I've narrowed it down to the export template; creating a brand new export template makes the facebook API work when deployed to my android device. Do you know which settings might be causing my other export template to fail? "Use custom build" is selected on both. Thanks!

DrMoriarty commented 3 years ago

When I face some strange errors related to android internal build system I usually go to android/build folder and do ./gradlew clean Sometime it helps

kjav commented 3 years ago

Thanks, that seemed to fix it!