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 run android, 就可以啦~~