美文网首页Flutter随笔
Flutter android build

Flutter android build

作者: 嘛尼嘛哄 | 来源:发表于2020-09-14 21:28 被阅读0次

    Android build

    Flutter官方文档:https://flutterchina.club/android-release/#%E5%88%9B%E5%BB%BA-keystore
    签名: keytool,需要提前安装jdk环境

    利用Keytool 创建

    keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key

    查看key.jks内容

    keytool -list -keystore key.jks

    配置对应的key.properties

    storePassword=123456
    keyPassword=123456
    keyAlias=android_key
    storeFile=/Users/userName/android_key.jks

    在app build.gradle中读取key.properties中的数据

    def keystoreProperties = new Properties()
    def keystorePropertiesFile = rootProject.file('key.properties')
    if (keystorePropertiesFile.exists()) {
        keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
    }
    
    signingConfigs {
            release {
                keyAlias keystoreProperties['keyAlias']
                keyPassword keystoreProperties['keyPassword']
                storeFile file(keystoreProperties['storeFile'])
                storePassword keystoreProperties['storePassword']
            }
    }
    

    相关文章

      网友评论

        本文标题:Flutter android build

        本文链接:https://www.haomeiwen.com/subject/zkvvsktx.html