This is a bit of a hack, but worked for my project:
- Add an Android project and a simple Java project to your workspace
- Go to Android project properties -> Java Build Path -> Source
- Click “Link Source” in the “Folder Name”, make sure you select the root directory of the plain tree of the Java src project.
- Use a descriptive name for "Linked Folder", for example, "java_project_src".
- Click Finish and compile
This setting will compile simple Java code as Dalvik bytecode. In my case, I had pure Java code with very limited dependencies, but I wanted to share pure Java code with projects other than Android, instead of separately supporting these files in each project.
source share