uni-app安卓云打包失败,报错#WX_SECRET@value requires a placeholder substitution but no value for is provided
uni-app安卓云打包失败,报错#WX_SECRET@value requires a placeholder substitution but no value for is provided
[PackagePath]/app/AndroidManifest.xml:47:16-56 Error: Attribute meta-data#WX_SECRET@value at AndroidManifest.xml:47:16-56 requires a placeholder substitution but no value for is provided. [PackagePath]/app/AndroidManifest.xml Error: Validation failed, exiting
FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ‘:app:processReleaseMainManifest’.
Manifest merger failed with multiple errors, see logs
- Try:
Run with --debug option to get more log output. Run with --scan to get full insights.
云端打包报错,关键词
- Attribute meta-data#WX_SECRET@value at AndroidManifest.xml:47:16-56 requires a placeholder substitution but no value for is provided.
- Execution failed for task ‘:app:processReleaseMainManifest’.
回退版本试试
在HBuilderX 3.98版本出现和你一样的错误
版本退回到3.95可以安卓云打包
在 uni-app 进行安卓云打包时,如果遇到报错 #WX_SECRET@value requires a placeholder substitution but no value for is provided
,通常是因为在项目的配置文件中缺少了必要的参数或占位符没有被正确替换。
解决方法:
-
检查
manifest.json
文件: 打开manifest.json
文件,检查是否有关于微信小程序或微信分享的配置项。通常,微信相关的配置项会包含WX_SECRET
这样的占位符。 -
配置微信 AppID 和 AppSecret: 如果你使用了微信相关的功能(如微信登录、微信分享等),你需要在
manifest.json
中正确配置微信的AppID
和AppSecret
。例如:"app-plus": { "distribute": { "sdkConfigs": { "share": { "weixin": { "appid": "your_weixin_appid", "appsecret": "your_weixin_appsecret" } } } } }
确保
appid
和appsecret
的值已经正确填写。 -
检查环境变量: 如果你使用了环境变量来动态替换
WX_SECRET
,请确保在打包时已经正确配置了环境变量。你可以在manifest.json
中使用process.env.WX_SECRET
来引用环境变量。 -
检查 HBuilderX 版本: 确保你使用的 HBuilderX 是最新版本,旧版本可能存在一些已知的 bug 或问题。
-
重新打包: 在完成上述配置后,重新进行云打包,看看问题是否解决。
示例配置:
假设你在 manifest.json
中配置了微信分享功能,并且使用了环境变量来动态替换 WX_SECRET
,配置可能如下:
"app-plus": {
"distribute": {
"sdkConfigs": {
"share": {
"weixin": {
"appid": "your_weixin_appid",
"appsecret": "process.env.WX_SECRET"
}
}
}
}
}