Solution 1 :
You declared your dependency in the android module, but MyGdxGame
is in your core module – that’s the problem here. You need to follow the documentation for working with platform dependant code.
Problem :
I have a problem in integration Facebook Sharedialog with my android libgdx game:
-
In build.gradle (Project), I added
mavenCentral()
in thebuildscript { repositories {}}
section. -
In build.gradle (Module: android) I added
implementation 'com.facebook.android:facebook-share:7.1.0'
andimplementation 'com.facebook.android:facebook-common:7.1.0'
in dependencies. -
But in my MyGdxGame when I declared
ShareDialog
, it came with following error:Cannot resolve symbol ShareDialog, Add library ‘Gradle:com.facebook.amdroid:facebook-common:[email protected]’ to classpath.
Even it did not recognize the
import com.facebook.share.widget.ShareDialog
.
I’ve tried the same with a normal Android app that is not Libgdx game and seen Facebook ShareDialog worked well.
Could you please advise if I did anything wrong?
I also tried with another library: gdx-facebook (https://github.com/TomGrill/gdx-facebook) but failed because the method publish_actions
was deprecated. The detail can be found here: https://developers.facebook.com/blog/post/2018/07/31/platform-update-publish-permission/
Comments
Comment posted by Kevin
Thanks for your comment. Actually I tried to declare the dependency in both Android and Core module but it didn’t work. Actually I tried with another platform also: com.codeandweb.physicseditor and there was no problem.
Comment posted by github.com/libgdx/libgdx/wiki/…
Follow this guide