简体   繁体   English

android-从命令行构建时的链接资源

[英]android - linked-resources when building from command line

During development, our Android app is built using Eclipse (ADT). 在开发过程中,我们的Android应用是使用Eclipse(ADT)构建的。 We use an eclipse feature called Linked Resources, which allows eclipse to compile files outside of the source tree. 我们使用一种称为链接资源的Eclipse功能,该功能允许Eclipse编译源代码树之外的文件。

It works well on eclipse, but when trying to compile from the command line (using android update project and ant ), ant/javac won't find the linked resources (as they are defined in the eclipse project). 它在eclipse上运行良好,但是当尝试从命令行进行编译时(使用android update projectant ),ant / javac将找不到链接的资源(因为它们是在eclipse项目中定义的)。

How can I make it work? 我该如何运作? Do I need to manually add the additional source dir to build.xml (which was auto-generated by android)? 我是否需要手动将其他源目录添加到build.xml(由android自动生成)? Is there an android setting I should use? 我应该使用一个android设置吗?

You could put the paths of the extra source code in the source.dir line of ant.properties in your project directory. 您可以将额外的源代码的路径放在项目目录中ant.properties的source.dir行中。 Something like this: 像这样:

source.dir=src;../ExtraSource;../MoreSource/java source.dir = SRC; ../ ExtraSource; ../ MoreSource / JAVA

See http://code.google.com/p/android/issues/detail?id=21205 for more discussion. 有关更多讨论,请参见http://code.google.com/p/android/issues/detail?id=21205 Apparently they took this feature out at some point but it looks like they have put it back in since then. 显然他们在某个时候取消了此功能,但看起来好像从那时起就将其放回去。

Are you using referencing library? 您正在使用引用库吗? If so, you need to tell ant where it can find the referencing library (typically in project.properties) 如果是这样,则需要告诉ant在哪里可以找到引用库(通常在project.properties中)

android.library.reference.1=/pathToReferenceLibrary

A referencing library is where you want to keep all classes and resouces that you want to reuse between different android projects. 引用库是您要保留所有类和资源的位置,这些类和资源要在不同的android项目之间重用。

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

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