cordova +uniapp 打包android

uniapp 打包后放入cordova www 文件包后一直白屏,卡了很久,在老大帮助下终于找到问题,以下是具体操作:

1. 在 manifest.json 修改下面内容:

    1)在mainfest.json中设置h5节点的publicPath为:’./'打包后即为相对路径   "publicPath":"./",

    2) mainfest.json中设置h5节点 增加以下内容:

       "router" : {
            "mode" : "hash",
            "basePath":""
        }

    修改后的 mainfest.json中 h5节点 的代码是这样的:

    "h5" : {
        "devServer" : {
            "port" : 8080,
            "disableHostCheck" : true
        },
        "title" : "项目标题",
        "domain" : "",
        "template" : "index.html",
        "publicPath":"./",
        "router" : {
            "mode" : "hash",
            "basePath":""
        }
    }

3. 修改打包后的配置文件

修改index.xxxxx.js文件的 uniConfig.router={mode:"hash",base:"/"}改成uniConfig.router={mode:"hash",base:"./"}

cordova +uniapp 打包android_第1张图片

 

然后重新cordova run android, 就可以啦~~

 

你可能感兴趣的:(hash,cordova)