請注意,如果您使用默認的Eclipse構建,它可能會在eclipse中使用特殊配置的「Ant」模塊。您可以通過檢查Eclipse/Prefs中的'Window/Preferences/Ant'部分來檢查Eclipse/Ant的協調程度....
一個解決方案是使Eclipse/Ant的協作更加明確, 'build.xml'文件是項目的一部分(項目級構建文件,而不是從$ SDK/ROOT文件夾生成時複製的默認文件)。
請參閱here並閱讀底部here的註釋以更好地瞭解如何使用項目級別「build.xml」文件。
一旦你消化的是,該解決方案如下會更有意義......
--Solution--
修改版本和你「的build.xml」的調試節文件內容如下:
<!-- **************** Debug specific targets *************** -->
...
<target name="-set-debug-mode" depends="-setup">
...
<!-- API modify belo for build-typ -->
<copy file="config/strings.xml" todir="res/values">
<filterset>
<filter token="CONFIG.API" value="${config.db.api}"/>
<filter token="CONFIG.REST" value="${config.db.rest}"/>
</filterset>
</copy>
...
<!-- *************** Release specific targets ************** -->
...
<target name="-set-release-mode" depends="-set-mode-check">
...
<!-- API modify belo for build-typ -->
<copy file="config/strings.xml" todir="res/values">
<filterset>
<filter token="CONFIG.API" value="${config.db.api.prod}"/>
<filter token="CONFIG.REST" value="${config.db.rest.prod}"/>
</filterset>
</copy>
,並在你的根文件夾中的「ant.properties」文件,把屬性值的API密鑰和什麼...
# API condition builds dev|prod in DB @parse.com
config.db.api=some_key_val
config.db.rest=some_k2_val
config.db.api.prod=some_k3_val
config.db.rest.prod=some_k4_val
而且在資源XML是的「複製」目標的構建命令綁在一起,它...
'config/strings.xml'
<string name="default_value_parse_key_appId">@[email protected]</string>
<string name="default_value_parse_key_rest">@[email protected]</string>
您使用的是什麼樣的構建系統? (maven,ant,gradle ...) – Fredszaq
無論日食使用:) – ericosg