2016-06-10 15 views
2

我在keystore.properties以下密鑰存儲信息存放在根文件夾Android Studio中不認識的性質宣佈簽約配置文件

storePassword=****** 
keyPassword=****** 
keyAlias=****** 
storeFile=/home/jerry/jerryKeyStore 

和下面的代碼的gradle加載它

// Create a variable called keystorePropertiesFile, and initialize it to your 
// keystore.properties file, in the rootProject folder. 
def keystorePropertiesFile = rootProject.file("keystore.properties") 

// Initialize a new Properties() object called keystoreProperties. 
def keystoreProperties = new Properties() 

// Load your keystore.properties file into the keystoreProperties object. 
keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) 

android { 

signingConfigs { 
    release { 
     keyAlias keystoreProperties['keyAlias'] 
     keyPassword keystoreProperties['keyPassword'] 
     storeFile file(keystoreProperties['storeFile']) 
     storePassword keystoreProperties['storePassword'] 
    } 
} 

當我打開項目結構窗口的簽名選項卡時,Android Studio會在所有簽名字段中讀取Unrecognized value。 它也不能在我的設備上安裝APK,拋出一個錯誤,APK用不同的鑰匙..建成與我簽約信息直接寫入文件的gradle

我用下面的
的Android Studio構建它:2.1.2
Gradle:2.1.0

+0

我現在有同樣的問題。我在Mac上使用Android Studio 2.3.1。我在除「存儲文件」之外的所有簽名字段中都收到了無法識別的值。不知道爲什麼它會在keystore.properties文件中找到該值,而不是其他值。 – Alyoshak

+0

嘗試通過模塊選項配置它..我這樣做,它適用於我..它也將處理gradle文件 –

+0

謝謝謝迪。我其實只是想出了我的問題。我將添加它作爲答案。它可以幫助某人。 – Alyoshak

回答

0

仔細檢查'keyAlias'的準確性。你應該也可能對'storeFile'懷疑。我這樣說是因爲我有一個非常類似的問題,因爲我拼錯了keyAlias,它阻止了系統訪問該文件,這肯定是我爲什麼會得到「無法識別的值」。但可能很容易出現這樣的情況:您的商店文件參考中沒有.jks擴展名,或者您的路徑錯誤,或者文件位於錯誤的文件夾中。

相關問題