KarelPeeters
KarelPeeters

Reputation: 1465

Android project depending on a Java project

I have a normal Java library project, called "PeriodicLib2", and an Android app project, called PeriodicApp2. Both are Intelij-Idea projects. I'm not using any build system, only what Idea has build-in.

I want PeriodicApp2 to depend on PeriodicLib2. I don't want to build my library project and add is as a library jar file, because I'm changing the library's code really frequent, and I would like the Android project to automatically build the library. I got something similar working, a java project depending on another java project. But when an android project depending on a java project, I get compile-time errors. These are the steps I tried to get PeriodicApp2 to depend on PeriodicLib2:

  1. In the Project Structure of PeriodicApp2, Add < Library < Java Step 1
  2. Select the library Step 2
  3. Press ok in the next 2 popups Step 3 - a Step 3 - b
  4. Check if the module is added Step 4
  5. Check if the library is added Step 5

I can import and use the classes in PeriodicLib2 according to the idea auto-completion, but when I compile, I get the following compile/build error: Error

I have been searching on Google & asking on #java, but I couln't find any solution. How can I get an Android project to depend on a pure Java project?

Upvotes: 0

Views: 78

Answers (1)

Theodorus
Theodorus

Reputation: 111

Library dependencies should be .jar files, if you want to add a dependency that consist of source code files, you can try to add it to your project as a module (import module), and add it as a module dependency to your PeriodicApp2 module.

Upvotes: 1

Related Questions