首先自己的keystore一定要有,不要用測試時的debug.keystore.
如果你想要在測試時也用自己的keystore,只需要在.gradle添加如下代碼
android {
signingConfigs { //簽名設置
debug {
storeFile file("release.keystore") //你的發佈用keystore
storePassword "asdf" //你的store密碼
keyAlias "asdf" //別名
keyPassword "asdf" //別名密碼
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
}
}
然後,下一個問題。
用studio打包apk的時候,如果你要用之前的.keystore證書而不是studio的.jks
只需要多填一個key.alias(別名)
查看key.alias(別名)的方式爲:
命令進入keystore文件所在的目錄 運行 keytool -list -v -keystore xxxx.keystore -storepass xxxxxxxxxx(密碼) 簽名的信息就有了
再然後,打包完成上線。。。