美文网首页工作生活
【Cordova/Electron学习笔记06】cordova签

【Cordova/Electron学习笔记06】cordova签

作者: 滕的世界 | 来源:发表于2019-08-05 10:57 被阅读0次

    1.生成签名

    按照要求填写,密码不能太简单

    keytool -genkeypair -alias debug.keystore -keyalg RSA -validity 36000 -keystore debug.keystore
    keytool -genkeypair -alias release.keystore -keyalg RSA -validity 36000 -keystore release.keystore
    

    存放到$cordova的根目录,也就是和www目录同级,结构如下

    - $cordova_root
        - www
        - build.json
        - debug.keystore
        - release.keystore
    

    2.添加编译配置,建议使用build.json,存放到Cordova根目录,即和www目录平级,内容如下

    {
        "android": {
            "debug": {
                "keystore": "./debug.keystore",
                "alias": "debug.keystore",
                "storePassword": "your_debug_pwd",
                "password": "your_debug_pwd",
                "keystoreType": ""
            },
            "release": {
                "keystore": "./release.keystore",
                "alias": "release.keystore",
                "storePassword": "your_release_pwd",
                "password": "your_release_pwd",
                "keystoreType": ""
            }
        }
    }
    

    3.编译打包apk命令

    cordova build --debug
    cordova build --release
    

    4.报密码不匹配的错误

    Failed to read key STORE from store "KEYSTORE": Keystore was tampered with, or password was incorrect
    

    报密码不匹配等错误,多次调整也无效,可能是打包APK的缓存的问题
    尝试清除下 ${cordova_root}/platforms/android/build目录

    5.Vue package.json中常用自定义命令

    "scripts": {
        ......
        "android": "cd ./platforms; cordova run android",
        "ios": "cd ./platforms; cordova run ios",
        "build:android": "./build_android.sh",
        "install:apk": "adb install -r ./dist_package/*release.apk"
      },
    

    相关文章

      网友评论

        本文标题:【Cordova/Electron学习笔记06】cordova签

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