在项目下创建一个
在android项目下的build.gradle中添加如下代码
def keystorePropertiesFile = rootProject.file("key.properties")
def keystoreProperties =new Properties()
def fileInputStream =new FileInputStream(keystorePropertiesFile)
keystoreProperties.load(fileInputStream)
如果不出现乱码以上代码即可,如果出现乱码,则读取时需要需要手动编码 可以是 gbk utf-8等
def mInputStreamReader =new InputStreamReader(fileInputStream,"UTF-8")
keystoreProperties.load(mInputStreamReader)
最后添加
signingConfigs{
release{
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
然后在控制台Terminal中直接输入 flutter build apk 即可
网友评论