简体   繁体   English

将非Android项目添加到Android项目

[英]Adding Non-Android Project to an Android Project

I have three projects in Eclipse: Base, Server, and AndroidClient. 我在Eclipse中有三个项目:Base,Server和AndroidClient。 The Base and Server are Java 1.7 projects, while the AndroidClient is obviously an android project. Base和Server是Java 1.7项目,而AndroidClient显然是android项目。 The base project has classes and files that are shared between the server and android client. 基础项目具有在服务器和android客户端之间共享的类和文件。

I understand that the Android doesn't use all of the normal Java classes and there's some deal about the Dalvik being different enough from the JVM that you have to compile them separately. 我了解到,Android并未使用所有普通的Java类,并且有很多关于Dalvik与JVM的区别,您必须单独编译它们。 Assuming I'm careful not to use any java classes that android doesn't support in the base project, is there any way to include the base project as a library to the android client in a simple way? 假设我很小心,不要在基础项目中使用android不支持的任何Java类,有没有办法以简单的方式将基础项目作为库包含到android客户端中?

Figured it out. 弄清楚了。 The answer is to open up your Android projects Properties, Build Path, and click "Link Source...". 答案是打开Android项目的“属性”,“构建路径”,然后单击“链接源...”。 Add the source directory for your base project. 添加您的基础项目的源目录。 Now, your android project will build those files for the android as well. 现在,您的android项目也将为android建立这些文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM