要配置 JKS 路径,你需要在 Flutter 项目的'android/app' 文件夹中创建一个名为'key.properties' 的文件,并在其中添加以下内容:

storePassword='<your-store-password>'
keyPassword='<your-key-password>'
keyAlias='<your-key-alias>'
storeFile='<your-jks-file-path>'

请将''、''、'' 和 '' 替换为你自己的值。

然后,在'android/app/build.gradle' 文件的 android 部分添加以下代码:

android {
    ...
    signingConfigs {
        release {
            if (project.hasProperty('keyAlias')) {
                storeFile file(keyProperties['storeFile'])
                storePassword keyProperties['storePassword']
                keyAlias keyProperties['keyAlias']
                keyPassword keyProperties['keyPassword']
            }
        }
    }
    ...
    buildTypes {
        release {
            ...
            signingConfig signingConfigs.release
        }
    }
}

这样你就可以在发布 Flutter 项目的时候使用 JKS 路径进行签名了。

Flutter 项目配置 JKS 路径详解

原文地址: https://www.cveoy.top/t/topic/pe60 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录