[英]Import source java project in Android project
Is it possible to import an existing Java project which is in my workspace, in an Android project which is also in my workspace? 是否可以导入我工作区中的现有Java项目,也在我的工作区中的Android项目中? The Java project doesn't use stuff that is incompatible with Android. Java项目不使用与Android不兼容的东西。 I could do it using a .JAR, but since I'm modifying the Java project a lot, I would like to import the whole source code and change it once in a while. 我可以使用.JAR来做,但由于我正在修改Java项目,我想导入整个源代码并偶尔更改一次。 Is it possible? 可能吗? Thanks 谢谢
This is somewhat of a hack, but worked for my project: 这有点像黑客,但对我的项目有用:
This setup will compile the plain-java code as Dalvik bytecode. 此设置将plain-java代码编译为Dalvik字节码。 In my case, I had pure java code with very limited dependencies, but wanted to share the pure java code with non-Android projects, instead of separately maintaining these files in every project. 在我的例子中,我有纯粹的java代码,依赖性非常有限,但是想要与非Android项目共享纯Java代码,而不是在每个项目中单独维护这些文件。
我认为您正在谈论将其他项目引用到当前项目中,如果是这种情况,那么您可以通过右键单击项目,属性 - >项目参考来完成此操作。
You can link another projects to your current project. 您可以将其他项目链接到当前项目。 Right click on your main project, choose Build Path -> Configure Build Path...
In the dialog choose the Projects
tab, then click Add..
button. 右键单击主项目,选择Build Path -> Configure Build Path...
在对话框中选择Projects
选项卡,然后单击Add..
按钮。 Now choose the project you want to link and click OK
. 现在选择要链接的项目,然后单击“ OK
。 You'll now be able to use this project's sources inside your main project. 您现在可以在主项目中使用此项目的源代码。 Hope this helps. 希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.