的原因「警告」是在Android main_rules.xml
項目($ANDROID_SDK_ROOT/tools/ant/main_rules.xml
)實際上記載:
<target name="-set-release-mode">
<!-- release mode is only valid if the manifest does not explicitly
set debuggable to true. default is false.
We actually store build.packaging.debug, not build.release -->
<xpath input="AndroidManifest.xml" expression="/manifest/application/@android:debuggable"
output="build.packaging.debug" default="false"/>
...
</target>
所以,你要檢查什麼build.mode.debug
(通過ant debug
執行),build.mode.release
(當@debuggable=false
與ant release
執行),最後,以滿足您的警告:build.packaging.debug
(當@debuggable=true
與ant release
執行)
這裏,將工作的例子自動預編譯:
<target name="-my-debug-precompile" if="build.mode.debug">
<!-- This is executed for any "debug" build ("ant debug") -->
</target>
<target name="-my-release-precompile" unless="build.mode.debug">
<!-- This is executed for any non-"debug" build (e.g., "ant release",
regardless of the @debuggable attribute in AndroidManifest.xml) -->
</target>
<!-- This is called automatically by Android's ant tasks, and delegates the
task to one of the above two targets: -->
<target name="-pre-compile" depends="-my-debug-precompile,-my-release-precompile" />
來源
2011-06-03 17:50:46
Joe
我知道,但我沒有看到的是,條件部分。 我想要加載兩個文件之一(release.properties/debug.properties),或者根據配置手動設置腳本中的屬性值。 以目錄路徑爲例,我想出/釋放和出/調試 – copolii 2011-06-02 18:20:55
@copolii使用任務:http://ant.apache.org/manual/Tasks/conditions.html –
2011-06-02 18:26:25
我知道條件任務,我需要實際條件......如果ant腳本正在使用「ant release」執行,而false使用「ant debug」或反之亦然,則評估爲true。 必須有一個屬性...在VisualStudio/MSBuild它的$(配置),其中評估'釋放'或'調試' – copolii 2011-06-02 18:39:23