Itxiaoguang
Itxiaoguang
  • 发布:2020-08-01 16:38
  • 更新:2020-11-07 16:06
  • 阅读:1090

【报Bug】安卓 getSystemInfo 不正确

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: 10

HBuilderX类型: 正式

HBuilderX版本号: 2.8.2

手机系统: Android

手机系统版本号: Android 10

手机厂商: 小米

手机机型: 小米8

页面类型: vue

打包方式: 离线

项目创建方式: HBuilderX

示例代码:
onLaunch: ()=> {  
            console.log('App Launch')  

            var ll = wx.getSystemInfo();  
            console.log(ll)  
            var lk = uni.getSystemInfo({  
                complete: (res)=> {  
                    console.log(res)  
                }  
            })  
            var lj = uni.getSystemInfoSync()  
            console.log(lj)  

            setTimeout(function(){  
                var ll = wx.getSystemInfo();  
                console.log(ll)  
                var lk = uni.getSystemInfo({  
                    complete: (res)=> {  
                        console.log(res)  
                    }  
                })  
                var lj = uni.getSystemInfoSync()  
                console.log(lj)  
            },1000)  
},

操作步骤:

uni.getSystemInfoSync(),第一次安装 或者 热启动 得到的打印是异常的值

预期结果:

{
"errMsg": "getSystemInfo:ok",
"brand": "Xiaomi",
"model": "MI 8",
"pixelRatio": 2.75,
"screenWidth": 393,
"screenHeight": 817,
"windowWidth": 393,
"windowHeight": 767,
"statusBarHeight": 32,
"language": "zh-CN",
"system": "10",
"version": "1.9.9.80255",
"fontSizeSetting": "",
"platform": "android",
"SDKVersion": "",
"windowTop": 0,
"windowBottom": 0,
"safeArea": {
"left": 0,
"right": 393,
"top": 32,
"bottom": 767,
"width": 393,
"height": 735
},
"safeAreaInsets": {
"top": 32,
"right": 0,
"bottom": 0,
"left": 0
}
}

实际结果:

{
"errMsg": "getSystemInfo:ok",
"brand": "Xiaomi",
"model": "MI 8",
"pixelRatio": 2.880000114440918,
"screenWidth": 375,
"screenHeight": 781,
"windowWidth": 375,
"windowHeight": 731,
"statusBarHeight": 32,
"language": "zh-CN",
"system": "10",
"version": "1.9.9.80255",
"fontSizeSetting": "",
"platform": "android",
"SDKVersion": "",
"windowTop": 0,
"windowBottom": 0,
"safeArea": {
"left": 0,
"right": 375,
"top": 32,
"bottom": 731,
"width": 375,
"height": 699
},
"safeAreaInsets": {
"top": 32,
"right": 0,
"bottom": 0,
"left": 0
}
}

bug描述:

在APP.vue onLaunch 或者其他 xx.vue 里面调这个方法
var ll = wx.getSystemInfo();
console.log(ll)
var lk = uni.getSystemInfo({
complete: (res)=> {
console.log(res)
}
})
var lj = uni.getSystemInfoSync()
console.log(lj)

第一次安装 或者 热启动 得到的打印是(该打印是异常的值):
{
"errMsg": "getSystemInfo:ok",
"brand": "Xiaomi",
"model": "MI 8",
"pixelRatio": 2.880000114440918,
"screenWidth": 375,
"screenHeight": 781,
"windowWidth": 375,
"windowHeight": 731,
"statusBarHeight": 32,
"language": "zh-CN",
"system": "10",
"version": "1.9.9.80255",
"fontSizeSetting": "",
"platform": "android",
"SDKVersion": "",
"windowTop": 0,
"windowBottom": 0,
"safeArea": {
"left": 0,
"right": 375,
"top": 32,
"bottom": 731,
"width": 375,
"height": 699
},
"safeAreaInsets": {
"top": 32,
"right": 0,
"bottom": 0,
"left": 0
}
}

不是第一次安装且是冷启动打印是(该打印是正常的值):
{
"errMsg": "getSystemInfo:ok",
"brand": "Xiaomi",
"model": "MI 8",
"pixelRatio": 2.75,
"screenWidth": 393,
"screenHeight": 817,
"windowWidth": 393,
"windowHeight": 767,
"statusBarHeight": 32,
"language": "zh-CN",
"system": "10",
"version": "1.9.9.80255",
"fontSizeSetting": "",
"platform": "android",
"SDKVersion": "",
"windowTop": 0,
"windowBottom": 0,
"safeArea": {
"left": 0,
"right": 393,
"top": 32,
"bottom": 767,
"width": 393,
"height": 735
},
"safeAreaInsets": {
"top": 32,
"right": 0,
"bottom": 0,
"left": 0
}
}

异常值就会导致APP底部白屏,视频video跑偏

2020-08-01 16:38 负责人:无 分享
已邀请:
DCloud_UNI_GSQ

DCloud_UNI_GSQ

其他设备测试是否有此问题

狗剩哥哥

狗剩哥哥

我也遇到了类似问题, 具体不知道是不是跟post主同一个bug。

我的是在onLoad执行getSystemInfoSync, 获取整个顶部导航的高度。

在 iOS系统中的效果 和 在安卓系统中 的效果如下。

我也拿过不同的 苹果手机 和 安卓手机测试, 苹果手机的效果是没问题的,安卓手机普遍出现偏差。

该问题目前已经被锁定, 无法添加新回复