uni-app AndroidManifest.xml配置文件不生效

uni-app AndroidManifest.xml配置文件不生效

信息类别 详细信息
产品分类 uniapp/App
PC开发环境 Windows
PC系统版本 Windows 11 企业版 22H2
HBuilderX 正式
HBuilderX版本 4.66
手机系统 Android
手机系统版本 Android 15
手机厂商 模拟器
手机机型 模拟器
页面类型 vue
vue版本 vue2
打包方式 云端
项目创建方式 HBuilderX

操作步骤:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
package="安卓包名">
<!--permissions-->  
<application android:usesCleartextTraffic="false">  
    <!--meta-data-->  
</application>  
</manifest>

预期结果:

<application android:usesCleartextTraffic="false">  
</application>

实际结果:

<application android:usesCleartextTraffic="true">  
</application>

bug描述:

在项目根目录下创建AndroidManifest.xml配置文件,在文件中配置了android:usesCleartextTraffic=“false”,打包之后对apk进行反编译,反编译后的AndroidManifest.xml文件内,android:usesCleartextTraffic 配置还是为true。


更多关于uni-app AndroidManifest.xml配置文件不生效的实战教程也可以访问 https://www.itying.com/category-93-b0.html

1 回复

更多关于uni-app AndroidManifest.xml配置文件不生效的实战教程也可以访问 https://www.itying.com/category-93-b0.html


在 uni-app 中,直接修改项目根目录下的 AndroidManifest.xml 文件不会生效,因为 uni-app 云端打包时使用的是引擎默认的 Android 清单文件。要自定义原生配置,需通过 manifest.json 中的 App 模块配置或使用原生插件。

对于 android:usesCleartextTraffic 属性,它控制是否允许明文 HTTP 流量。uni-app 默认设为 true 以确保网络请求兼容性。若需禁用,可在 manifest.json 的 “app-plus” -> “distribute” -> “google” 下添加:

"xml": {
    "android": {
        "usesCleartextTraffic": false
    }
}
回到顶部