2013-08-05 163 views
3

我從命令行構建android應用程序。我需要簽署我的應用程序才能在設備上安裝內置的.apk文件。爲此,我需要在ant.properties文件中寫入key.store和key.alias。但ant.properties文件丟失。所以任何人都知道請讓我知道。安卓項目中缺少ant.properties文件

+0

你確定你是用Ant構建您的APK手動創建ant.properties文件?您的項目中是否爲.gradle文件? – Casabian

+0

是的,我正在建設與螞蟻..我的項目的根沒有這樣的.grade文件.. – user2652046

+0

我手動複製一個ant.properties文件,然後我寫這裏key.store和key.alias來簽署應用程序。當我使用ant構建文件時,它會生成未簽名的.apk文件。它也在cmd中同時發生錯誤。錯誤是「密鑰庫的值不是有效的,它必須是單個路徑」 – user2652046

回答

7

運行android update project -p .

具有以下內容

# This file is used to override default values used by the Ant build system. 
# 
# This file must be checked in Version Control Systems, as it is 
# integral to the build system of your project. 

# This file is only used by the Ant script. 

# You can use this to override default values such as 
# 'source.dir' for the location of your java source folder and 
# 'out.dir' for the location of your output folder. 

# You can also use it define how the release builds are signed by declaring 
# the following properties: 
# 'key.store' for the location of your keystore and 
# 'key.alias' for the name of the key to use. 
# The password will be asked during the build when you use the 'release' target. 

android.library.reference.1=###link to any external libraries#### 

key.alias=android_key 
key.store.password==######### 
config.logging=false 
key.store=#########path to keystore########## 
key.alias.password=###### 
+4

這對我不起作用。當我運行android update project -p時,我沒有得到一個ant.properties文件。是什麼賦予了? – kmdupr33

+0

@Tarun,你知道如何使用ant.properties從不同的目錄比platform/android/http://stackoverflow.com/questions/29404465/ant-properties-custom-path-when-building-apk – fedmich