2016-10-17 34 views
1

我有QtAppandroid我使用以下命令構建command line。它使用螞蟻構建。非常棒。建立良好。運行良好。下面的核心命令創建&爲我簽名apk。如何使用ant命令行來選擇我的自定義build.xml

ANT_OPTIONS=" -ant" 
Path/To/androiddeployqt --sign /Path/to/MyKey.keystore MyAlias --storepass MyPassword --output android --verbose --input /path/to/android-libMyQtApp.so-deployment-settings.json $ANT_OPTIONS 

接下來,我有幾個版本的定製做了,我需要創建自己的build.xml &使螞蟻挑我的自定義的build.xml。我閱讀了以下描述使用-buildfile &的ant官方頁面,指出您可以提及包含自定義build.xml的目錄。 https://ant.apache.org/manual/running.html

由於我想用我的自定義的build.xml,我在我的項目目錄中創建,我做在命令以下變化。

ANT_OPTIONS=" -ant -buildfile '/Directory/containing/my_build.xml'" 
Path/To/androiddeployqt --sign /Pathto/MyKey.keystore MyAlias --storepass MyPassword --output android --verbose --input /path/to/android-libMyQtApp.so-deployment-settings.json $ANT_OPTIONS 

但仍然螞蟻拿起默認生成的build.xml。我的ANT_OPTIONS有什麼問題? androiddeployqt不允許我傳遞額外的ant命令行選項嗎?

或者,是否有可能創建一個ant.properties文件,使螞蟻拿起我的自定義生成命令? 我只是想增加我的Android應用

回答

2

按照apache-ant documentation的版本號有可供選擇的構建腳本三個選項,如果沒有被默認名稱(build.xml)。

-buildfile <file>  use given buildfile 
    -file <file>    '' 
    -f  <file>    '' 

而且你可以看到下面,上述所有版本的工作:

- bash $~/Documents/so$ ant -buildfile build-regex.xml 
Buildfile: /home/apps/Documents/so/build-regex.xml 

myTarget: 
    [echo] D:/MyFolder/abc/ 

BUILD SUCCESSFUL 
Total time: 0 seconds 
- bash $~/Documents/so$ ant -f build-regex.xml 
Buildfile: /home/apps/Documents/so/build-regex.xml 

myTarget: 
    [echo] D:/MyFolder/abc/ 

BUILD SUCCESSFUL 
Total time: 0 seconds 
- bash $~/Documents/so$ ant -file build-regex.xml 
Buildfile: /home/apps/Documents/so/build-regex.xml 

myTarget: 
    [echo] D:/MyFolder/abc/ 

BUILD SUCCESSFUL 
Total time: 0 seconds 

您試圖選擇-buildfile,這是奇怪的是沒有工作。您可以嘗試-f-file選項。

+0

你在嘗試'ant -buildfile'命令statndalone嗎?或者用'androiddeployqt'。在我的情況下,它是一個QtApp,我正在構建命令行,爲此我使用了一個名爲'androiddeployqt'的命令行工具。該工具有一個'-ant'選項。但它不接受'-buildfile'作爲螞蟻的額外參數 –

+0

如您所見,它是命令行'ant',沒有'android'。儘管嘗試過其他選擇? – Rao

+1

感謝您的建議,直到尚未。命令行螞蟻很好地獨立工作。毫無疑問。我的問題在這裏螞蟻與'androiddeployqt'的組合給出了問題。 –

相關問題