简体   繁体   English

android布局并导出jar

[英]android layouts and exporting a jar

The problem is this: 问题是这样的:

I have an android layout, let's call it ad.xml. 我有一个android布局,我们称它为ad.xml。 Ad.xml will be included in my android project, and from there eclipse generates the R.* classes. Ad.xml将包含在我的android项目中,然后从eclipse那里生成R. *类。

I an another project called ad-sdk, that will be exported as a jar, and contains a class that references those R.* classes being generated in the project that contains the ad layout. 我还有一个名为ad-sdk的项目,该项目将作为jar导出,并包含一个类,该类引用在包含广告布局的项目中生成的R. *类。

If I export the jar, it exports with compile time errors. 如果导出jar,则导出时会出现编译时错误。 Is there anyway that a jar can be exported that references classes from another project. 无论如何,是否可以导出引用另一个项目中的类的jar。 It doesn't seem like there would be way, but I wanted to make sure. 似乎没有办法,但是我想确保。

Essentially, I want to be able to create multiple projects, drag in the ad.xml to each of those projects, which then results in R.* class files, and include the ad-sdk.jar in each of those projects. 本质上,我希望能够创建多个项目,将ad.xml拖到每个项目中,然后生成R. *类文件,并在每个项目中包含ad-sdk.jar。

Is there anyway that a jar can be exported that references classes from another project. 无论如何,是否可以导出引用另一个项目中的类的jar。

Not from the hosting project directly via R values. 不是直接通过R值来自托管项目。

Essentially, I want to be able to create multiple projects, drag in the ad.xml to each of those projects, which then results in R.* class files, and include the ad-sdk.jar in each of those projects. 本质上,我希望能够创建多个项目,将ad.xml拖到每个项目中,然后生成R. *类文件,并在每个项目中包含ad-sdk.jar。

Pass in the R.layout value to the host's desired layout to the JAR via some API, and have the JAR use that layout instead of hard-wiring in R.layout.ad . 通过一些API将R.layout值传递到主机所需的布局到JAR,并让JAR使用该布局,而不是在R.layout.ad进行硬接线。

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

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