1、打開終端
2、去到java安裝的根目錄,即輸入
cd /Library/Java/Home/bin/
3、當前用戶沒有最高權限,在Library文件夾下不能生成任何文件,可以到當前用戶目錄下生成文件
keytool -genkey -v -keystore android.keystore -alias android -keyalg RSA -validity 20000 -keystore /Users/當前用戶的用戶名/android_demo.keystore
如果當前的用戶名是xiaoming,則如下
keytool -genkey -v -keystore android.keystore -alias android -keyalg RSA -validity 20000 -keystore /Users/xiaoming/android_demo.keystore
4、按照提示輸入即可,完整代碼如下
xiaomingdeiMac:/ xiaoming$ cd /Library/Java/Home/bin/ xiaomingdeiMac:bin xiaoming$ keytool -genkey -v -keystore android.keystore -alias android -keyalg RSA -validity 20000 -keystore /Users/xiaoming/android_demo.keystore Enter keystore password: Re-enter new password: What is your first and last name? [Unknown]: Li XiaoMing What is the name of your organizational unit? [Unknown]: www.xiaoming.com What is the name of your organization? [Unknown]: 小明集團 What is the name of your City or Locality? [Unknown]: 廣州 What is the name of your State or Province? [Unknown]: 廣東省 What is the two-letter country code for this unit? [Unknown]: 86 Is CN=Li XiaoMing, OU=www.xiaoming.com, O=小明集團, L=廣州, ST=廣東省, C=86 correct? [no]: yes Generating 1,024 bit RSA key pair and self-signed certificate (SHA1withRSA) with a validity of 20,000 days for: CN=Li XiaoMing, OU=www.xiaoming.com, O=小明集團, L=廣州, ST=廣東省, C=86 Enter key password for <android> (RETURN if same as keystore password): [Storing /Users/xiaoming/android_demo.keystore]
5、到這里就可以到當前用戶根目錄下查看生產的keystore簽名文件了
參考官網:http://developer.android.com/intl/zh-cn/tools/publishing/app-signing.html#signing-manually
本文鏈接:http://www.cnblogs.com/liqw/articles/4064662.html