打开横竖屏。usb调试时可以横竖屏切换,但是打包发布后却不行?
解决方式
需要manifest.json打开一下配置才会生效,否则打包的apk默认只有竖屏。
javascript
"app-plus": {
"screenOrientation": [
"portrait-primary", // 竖屏(正向)
"landscape-primary", // 横屏(正向)
"portrait-secondary", // 竖屏(反向,可选)
"landscape-secondary" // 横屏(反向,可选)
],
// 其他配置...
}
javascript
{
// "name" : "mes",//正式
"name" : "mes测试版",
"appid" : "__UNI__0D65B3A",
"description" : "",
"versionName" : "1.0.0",
"versionCode" : 1,
"transformPx" : false,
"sassImplementationName" : "node-sass",
/* 5+App特有相关 */
"app-plus" : {
// "softinput": {
// "mode": "adjustResize" // 仅调整页面高度,不自动滚动
// },
"screenOrientation" : [
"portrait-primary", // 竖屏(正向)
"landscape-primary", // 横屏(正向)
"portrait-secondary", // 竖屏(反向,可选)
"landscape-secondary" // 横屏(反向,可选)
],
"compatible" : {
"ignoreVersion" : true //true表示忽略版本检查提示框,HBuilderX1.9.0及以上版本支持
},
"permissions" : {
"camera" : true
},
"usingComponents" : true,
"nvueStyleCompiler" : "uni-app",
"compilerVersion" : 3,
"splashscreen" : {
"alwaysShowBeforeRender" : true,
"waiting" : true,
"autoclose" : true,
"delay" : 0
},
/* 模块配置 */
"modules" : {
"Camera" : {},
"Barcode" : {}
},
/* 应用发布信息 */
"distribute" : {
/* android打包配置 */
"android" : {
"permissions" : [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
],
"abiFilters" : [ "armeabi-v7a", "arm64-v8a" ],
"minSdkVersion" : 21,
// "package": "com.keyang.mes",//正式
"package" : "com.keyang.mes.meta" //测试包名
},
/* ios打包配置 */
"ios" : {
"dSYMs" : false
},
/* SDK配置 */
"sdkConfigs" : {
"ad" : {}
},
"icons" : {
"android" : {
"hdpi" : "unpackage/res/icons/72x72.png",
"xhdpi" : "unpackage/res/icons/96x96.png",
"xxhdpi" : "unpackage/res/icons/144x144.png",
"xxxhdpi" : "unpackage/res/icons/192x192.png"
},
"ios" : {
"appstore" : "unpackage/res/icons/1024x1024.png",
"ipad" : {
"app" : "unpackage/res/icons/76x76.png",
"app@2x" : "unpackage/res/icons/152x152.png",
"notification" : "unpackage/res/icons/20x20.png",
"notification@2x" : "unpackage/res/icons/40x40.png",
"proapp@2x" : "unpackage/res/icons/167x167.png",
"settings" : "unpackage/res/icons/29x29.png",
"settings@2x" : "unpackage/res/icons/58x58.png",
"spotlight" : "unpackage/res/icons/40x40.png",
"spotlight@2x" : "unpackage/res/icons/80x80.png"
},
"iphone" : {
"app@2x" : "unpackage/res/icons/120x120.png",
"app@3x" : "unpackage/res/icons/180x180.png",
"notification@2x" : "unpackage/res/icons/40x40.png",
"notification@3x" : "unpackage/res/icons/60x60.png",
"settings@2x" : "unpackage/res/icons/58x58.png",
"settings@3x" : "unpackage/res/icons/87x87.png",
"spotlight@2x" : "unpackage/res/icons/80x80.png",
"spotlight@3x" : "unpackage/res/icons/120x120.png"
}
}
},
"splashscreen" : {
"androidStyle" : "common"
}
},
"nvueLaunchMode" : ""
},
/* 快应用特有相关 */
"quickapp" : {},
/* 小程序特有相关 */
"mp-weixin" : {
"appid" : "qqqq132123",
"setting" : {
"urlCheck" : false
},
"usingComponents" : true
},
"mp-alipay" : {
"usingComponents" : true
},
"mp-baidu" : {
"usingComponents" : true
},
"mp-toutiao" : {
"usingComponents" : true
},
"uniStatistics" : {
"enable" : false
},
// 192.168.10.25:512 _default
// 192.168.180.30:82
"h5" : {
"devServer" : {
"port" : 8000,
"disableHostCheck" : true,
"proxy" : {
"/api" : {
// "target" : "http://localhost:5001",
// "target" : "http://192.168.1.4:5001",
// "target": "http://10.70.119.35:5001",
// "target": "http://10.70.119.214:3306",
// "target": "http://10.70.119.214:5001",//滁州接口地址
"target" : "http://10.70.119.212:5001", //滁州接口地址
"changeOrigin" : true,
"secure" : false,
"logLevel" : "debug",
"pathRewrite" : {
"^/api" : ""
}
},
"/pda" : {
"target" : "http://10.70.119.35:82",
// "target" : "http://localhost:82",
// "target" : "http://192.168.1.4:82",
"changeOrigin" : true,
"secure" : false,
"logLevel" : "debug",
"pathRewrite" : {
"^/pda" : ""
}
}
}
}
},
"locale" : "auto"
}