我有一個滿是罐子(felix包)的目錄。我想遍歷所有這些jar並創建dex'd版本。我的意圖是將這些dex'd罐中的每一個都部署爲獨立apk,因爲它們是捆綁在一起的。如果我從錯誤的方向接近這一點,請隨時將我理清。使用Ant我如何定義一個罐子目錄?
第一部分只是嘗試爲每個jar創建一個對應的.dex文件。但是,當我運行這個時,我得到了一個「沒有資源指定」錯誤出來的Ant。
這是正確的方法,還是有一個簡單的方法來輸入一個jar並輸出該jar的dex'd版本? $ {file}是有效的,因爲它正在echo命令中分發文件的名稱。
<target name="dexBundles" description="Run dex on all the bundles">
<taskdef resource="net/sf/antcontrib/antlib.xml" classpath="${basedir}/libs/ant-contrib.jar" />
<echo>Starting</echo>
<for param="file">
<path>
<fileset dir="${pre.dex.dir}">
<include name="**/*.jar" />
</fileset>
</path>
<sequential>
<echo message="@{file}" />
<echo>Converting jar file @{file} into ${post.dex.dir}/@{file}.class...</echo>
<apply executable="${dx}" failonerror="true" parallel="true" verbose="true">
<arg value="--dex" />
<arg value="--output=${post.dex.dir}/${file}.dex" />
<arg path="@{file}" />
</apply>
</sequential>
</for>
<echo>Finished</echo>
</target>
太棒了。謝謝。 – cbeaudin
我使用ant導出了資源文件夾中的資源jar。現在我希望這些資源成爲.dex的一部分。任何想法如何實現這個? – AndroidGuy