uni-app 云打包自定义基座报错 Execution failed for task ':app:processReleaseResources'
uni-app 云打包自定义基座报错 Execution failed for task ‘:app:processReleaseResources’
1、打本地安卓资源文件到Android Studio运行在UniPlugin-Hello-AS能正常使用 2、云打包自定义基座报错,已勾选了本地插件
Appid: UNI41BEA73
FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ‘:app:processReleaseResources’.
/home/[Name]/.gradle/caches/transforms-2/files-2.1/c5f685d9c6937bbe8706e1852444688c/selectfile/res/values/values.xml:20:5-32:13: AAPT: error: style attribute ‘attr/colorPrimaryVariant (aka chat.fatesgo.com:attr/colorPrimaryVariant)’ not found.
/home/[Name]/.gradle/caches/transforms-2/files-2.1/c5f685d9c6937bbe8706e1852444688c/selectfile/res/values/values.xml:20:5-32:13: AAPT: error: style attribute ‘attr/colorOnPrimary (aka chat.fatesgo.com:attr/colorOnPrimary)’ not found.
/home/[Name]/.gradle/caches/transforms-2/files-2.1/c5f685d9c6937bbe8706e1852444688c/selectfile/res/values/values.xml:20:5-32:13: AAPT: error: style attribute ‘attr/colorSecondary (aka chat.fatesgo.com:attr/colorSecondary)’ not found.
/home/[Name]/.gradle/caches/transforms-2/files-2.1/c5f685d9c6937bbe8706e1852444688c/selectfile/res/values/values.xml:20:5-32:13: AAPT: error: style attribute ‘attr/colorSecondaryVariant (aka chat.fatesgo.com:attr/colorSecondaryVariant)’ not found.
/home/[Name]/.gradle/caches/transforms-2/files-2.1/c5f685d9c6937bbe8706e1852444688c/selectfile/res/values/values.xml:20:5-32:13: AAPT: error: style attribute ‘attr/colorOnSecondary (aka chat.fatesgo.com:attr/colorOnSecondary)’ not found.
/home/[Name]/.gradle/caches/transforms-2/files-2.1/c5f685d9c6937bbe8706e1852444688c/selectfile/res/values/values.xml:20:5-32:13: AAPT: error: resource attr/colorPrimaryVariant (aka chat.fatesgo.com:attr/colorPrimaryVariant) not found.
/home/[Name]/.gradle/caches/transforms-2/files-2.1/c5f685d9c6937bbe8706e1852444688c/selectfile/res/values-night-v8/values-night-v8.xml:3:5-15:13: AAPT: error: style attribute ‘attr/colorPrimaryVariant (aka chat.fatesgo.com:attr/colorPrimaryVariant)’ not found.
/home/[Name]/.gradle/caches/transforms-2/files-2.1/c5f685d9c6937bbe8706e1852444688c/selectfile/res/values-night-v8/values-night-v8.xml:3:5-15:13: AAPT: error: style attribute ‘attr/colorOnPrimary (aka chat.fatesgo.com:attr/colorOnPrimary)’ not found.
/home/[Name]/.gradle/caches/transforms-2/files-2.1/c5f685d9c6937bbe8706e1852444688c/selectfile/res/values-night-v8/values-night-v8.xml:3:5-15:13: AAPT: error: style attribute ‘attr/colorSecondary (aka chat.fatesgo.com:attr/colorSecondary)’ not found.
/home/[Name]/.gradle/caches/transforms-2/files-2.1/c5f685d9c6937bbe8706e1852444688c/selectfile/res/values-night-v8/values-night-v8.xml:3:5-15:13: AAPT: error: style attribute ‘attr/colorSecondaryVariant (aka chat.fatesgo.com:attr/colorSecondaryVariant)’ not found.
/home/[Name]/.gradle/caches/transforms-2/files-2.1/c5f685d9c6937bbe8706e1852444688c/selectfile/res/values-night-v8/values-night-v8.xml:3:5-15:13: AAPT: error: style attribute ‘attr/colorOnSecondary (aka chat.fatesgo.com:attr/colorOnSecondary)’ not found.
/home/[Name]/.gradle/caches/transforms-2/files-2.1/c5f685d9c6937bbe8706e1852444688c/selectfile/res/values-night-v8/values-night-v8.xml:3:5-15:13: AAPT: error: resource attr/colorPrimaryVariant (aka chat.fatesgo.com:attr/colorPrimaryVariant) not found.
- Try:
Run with --debug option to get more log output. Run with --scan to get full insights.
- Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:processReleaseResources'.
...
BUILD FAILED in 4s
gradle build error: 1
更多关于uni-app 云打包自定义基座报错 Execution failed for task ':app:processReleaseResources'的实战教程也可以访问 https://www.itying.com/category-93-b0.html
请问解决了吗?我也遇到了。
这个错误是由于插件 selectfile 的资源文件引用了 Material Design 主题属性,但云打包环境的基础模板中可能缺少对应的主题定义。
从错误信息看,selectfile 插件(可能是某个文件选择插件)的 values.xml 中引用了以下属性:
attr/colorPrimaryVariantattr/colorOnPrimaryattr/colorSecondaryattr/colorSecondaryVariantattr/colorOnSecondary
这些是 Material Components 1.3.0+ 中引入的主题属性。在本地 Android Studio 中能正常运行,是因为你的本地环境包含了相应的依赖库,但云打包服务器的默认模板可能使用的是较低版本的依赖。
解决方案:
- 检查插件配置:确认
selectfile插件是否指定了正确的dependencies。在插件的package.json中,确保 Android 配置部分包含必要的依赖:
"dependencies": {
"implementation 'com.google.android.material:material:1.4.0'"
}
- 升级 uni-app 项目基础配置:在项目的
manifest.json中,尝试配置使用更高版本的 Material Design:
"app-plus": {
"android": {
"compileSdkVersion": 30,
"targetSdkVersion": 30,
"appTheme": "@android:style/Theme.MaterialComponents.Light.NoActionBar"
}
}
- 检查原生插件资源:如果插件是你自己开发的,检查插件 Android 部分的
build.gradle,确保已添加:
dependencies {
implementation 'com.google.android.material:material:1.4.0'
}


