I have three projects in the Eclipse workspace:
- A maven-based library project that generates a .jar file. This project contains our main code.
- Java desktop application based on maven. This application is library dependent.
- The Android application that we just started to create. This is not yet stunned.
I want the Android application to use the library project as a dependency.
I read several answers to similar questions about adding a library file dependency to an Android application, and I tried to execute them:
Method # 1:
Project-> Properties-> Java Build Path-> Projects β Add and Add Library Project.
Now I can use the classes from the library project. The compiler does not generate any warnings. However, when I run the application on the emulator, I get an error not defined by the class.
Method No. 2:
Copy the generated .jar file to the "libs" directory of the Android application.
It works. Class exception thrown. However, I cannot connect the source and therefore cannot go through the library code. In addition, every time the source changes, I will have to manually copy the .jar file.
Method 3:
Go to the Library Project Properties section. In the left pane you will see "Android". Select it and check the "IsLibrary" box.
In my case, however, there is no βAndroidβ property in the left pane. I assume that this property is displayed only if it is a real Android library project.
I am stuck. I would appreciate it if someone could tell me how best to deal with this situation.
Here is a summary of what I want to achieve:
- The same library project that will be used in the desktop application as an Android application.
- In an Android app, source code debugging should work.
- If there are any changes to the source code in the library application, the Android application should automatically receive new changes (instead, I try to drag the new .jar file into the libs folder every time).
java android eclipse
Peter
source share