sdk36下打包完成后 uni-app安卓16手机上都会出现无法进行网络请求
sdk36下打包完成后 uni-app安卓16手机上都会出现无法进行网络请求
示例代码:
uni.request请求代码
tabBar原生底部栏
## 操作步骤:
sdk36+vue3下打包的apk在安卓16下必复现
预期结果:
解决这个问题
## 实际结果:
等待解决
bug描述:
sdk36下打包完成后,安卓16手机上都会出现无法进行网络请求,原生tabBar底部栏被虚拟homt按键遮挡,着急着急着急,麻烦技术人员重视,目前问题非常严重

| 信息类别 | 详细信息 |
|--------------|------------------|
| 产品分类 | uniapp/App |
| PC开发环境 | Windows |
| PC版本号 | 4.76.2025073103-alpha |
| HBuilderX | 正式 |
| HBuilderX版本 | 4.76 |
| 手机系统 | Android |
| 手机版本号 | Android 16 |
| 手机厂商 | 华为 |
| 手机机型 | 华为小米三星安卓16所有,部分安卓15 |
| 页面类型 | vue |
| Vue版本 | vue3 |
| 打包方式 | 云端 |
| 项目创建方式 | HBuilderX |
更多关于sdk36下打包完成后 uni-app安卓16手机上都会出现无法进行网络请求的实战教程也可以访问 https://www.itying.com/category-93-b0.html
return new Promise((resolve, reject) => { uni.request({ method: config.method || ‘get’, timeout: config.timeout || timeout, url: config.baseUrl || baseUrl + config.url, data: config.data, header: config.header, sslVerify:false, enableHttp2: true, // withCredentials: true, // h5 true才会自动获取cookie和自动传递cookie dataType: ‘json’ }).then(response => { uni.hideLoading() let {data,statusCode} = response const res = data; if (statusCode != 200) { // toast(‘服务器无响应,请检查网络!’) reject(‘服务器无响应,请检查网络!’) return } const code = (res && res.code) || 200 const msg = errorCode[code] || (res && res.msg) || errorCode[‘default’] if (code === 401) { let exists = uni.getStorageSync(‘token_expired’) || false if (!exists) { uni.setStorageSync(‘token_expired’, true) uni.showModal({ title: ‘提示’, content: “登录状态已过期,您可以继续留在该页面,或者重新登录?”, cancelText: ‘取消’, confirmText: ‘去登陆’, success: function(res) { if (res.confirm) { store.dispatch(‘LogOut’).then(res => { uni.navigateTo({ url: ‘/pages/login’ }) }) } uni.setStorageSync(‘token_expired’, false) } }) uni.hideLoading() reject(‘401’) return ; } setTimeout(()=>{ uni.setStorageSync(‘token_expired’, false) },5000) reject(‘登录已过期,请重新登录。’) } else if (code === 500) { toast(msg) reject(‘500’) } else if (code === 501) { uni.showModal({ title:“VIP权限提醒”, content:msg, confirmText:“去开通”, success: (res) => { if(res.confirm){ uni.navigateTo({url:"/pages-b/vip/index"}); } } }) reject(‘501’) } else if (code !== 200) { toast(msg) reject(code) } resolve(res) }) .catch(error => { if(config.url.indexOf(“getVerification”) != -1){ uni.showModal({ content:"::::"+JSON.stringify(error) }) } let { message } = error if (message === ‘Network Error’) { message = ‘服务器无响应,请检查网络’ } else if (message.includes(‘timeout’)) { message = ‘请求超时,请检查网络’ } else if (message.includes(‘Request failed with status code’)) { message = ‘系统’ + message.substr(message.length - 3) + ‘异常’ } toast(message) reject(error) }) })
代码如上
在 Android 16(API 36)中,网络请求失败和虚拟按键遮挡 tabBar 是两个常见问题,通常与系统权限和样式适配有关。
网络请求问题:
- 检查
manifest.json中是否配置了网络权限:{ "permissions": { "android": { "uses-permission": ["android.permission.INTERNET"] } } } - 确认请求地址为 HTTPS(Android 高版本默认禁用 HTTP)。
- 尝试在
manifest.json中启用"unsecure": true仅用于测试(正式环境不推荐)。
虚拟按键遮挡 tabBar:
在 pages.json 中为 tabBar 添加安全区域适配:
{
"tabBar": {
"style": {
"safeArea": {
"bottom": {
"offset": "auto"
}
}
}
}
}


