Access Android Module Classes From Core Module Classes in libgdx

I was integrating my (libgdx) core module with android module to compile my whole project into one big project. However, at the end of this integration, I ran into a problem which I didn't think before.

I am not able to access the functions in the android module from the core module. However, I can access from android to core. I used the default libgdx setup.jar to create my libgdx project for android. I tried to include the android module as a dependency in the core module but that leads to an error stating Error: Circular reference between projects: :android -> :core -> :android. So I thought why not make another java module such that another_module depends on core module and then android module will depend on another_module. But doing this led to this error stating Error:Module ':core:1.0' depends on one or more Android Libraries but is a jar. I tried making another_module as a java library but the error is the same.

Now I am sure that there is a solution for this. Maybe making an Interface somehow in android module that core module can access.

I am new to all this. Any suggestions, recommendations or a solution perhaps?


Well after tons of research I figured out a solution for my problem. We can solve this problem with the help of interfaces without touching the Gradle part. All we have to do is create an interface in the core module and then implement it in some class in the android module and then pass that class to the core module through AndroidLauncher.

For Detailed Details refer to libGDX on Interfacing with platform specific code

I won't delete this post so that others who are also facing this problem can see this post and not waste a lot of their time on trying to fix Gradle.