'How do I create a dependency and call methods from Android Java project into an Idea java Project using Intellij?

I'm using Intellij with 1 Android java module and an IntelliJ IDEA Java module in the same project. Module B is dependant on Module A. The Idea module references the app module via import MyAndroidPackage.

The modules have seperate run applications in the project. If I run the Idea Android app module, I get no issues. If I run the Idea module I get

java: package R does not exist 

inside the Android app class named Mainactivity.java. If I remove

setContentView(R.layout.activity_main);

from the same Android class, both modules run with no problems, except the Android app no longer has any layout. I'm using a basic Android java app template, with nothing modified from creation.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source