Flutter签名

Flutter项目跟目录命令行输入:

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

回车之后,输入两次要设置的密码,和一些相关的信息

输入查看签名详情 包括SHA1等信息

keytool -list -v -keystore D:\key.jks

配置android\app\build.gradle 在buildTypes上面添加

// 新增
    signingConfigs {
        release {
            storeFile file("D:/key.jks")
            storePassword "123456"
            keyAlias "hello"
            keyPassword "123456"
        }
        debug {//debug版签名配置
            storeFile file("D:/key.jks")
            storePassword "123456"
            keyAlias "hello"
            keyPassword "123456"
        }
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            // signingConfig signingConfigs.debug
            signingConfig signingConfigs.release
        }
        // 添加一个debug
        debug {
            signingConfig signingConfigs.debug
        }
    }

你可能感兴趣的:(flutter,keytool)