7***@qq.com
7***@qq.com
  • 发布:2021-03-29 19:43
  • 更新:2023-03-29 09:55
  • 阅读:9525

【报Bug】 AAPT: error: style attribute 'android:attr/forceDarkAllowed' not found.

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

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

HBuilderX类型: 正式

HBuilderX版本号: 3.1.4

手机系统: Android

手机系统版本号: Android 8.1

手机厂商: 华为

手机机型: 安卓

页面类型: vue

打包方式: 云端

项目创建方式: HBuilderX

操作步骤:

离线打包
离线打包

从2.7.14 升级到3.1.4 报错
AAPT: error: style attribute 'android:attr/forceDarkAllowed' not found.
AAPT: error: style attribute 'android:attr/forceDarkAllowed' not found.
AAPT: error: style attribute 'android:attr/forceDarkAllowed' not found.
AAPT: error: style attribute 'android:attr/forceDarkAllowed' not found.
AAPT: error: style attribute 'android:attr/forceDarkAllowed' not found.
AAPT: error: style attribute 'android:attr/forceDarkAllowed' not found.

<style name="DCloudTheme" parent="Theme.AppCompat.Light.NoActionBar">  
    <item name="android:windowNoTitle">true</item>  
    <item name="android:colorEdgeEffect">#333333</item>  
    <item name="android:windowBackground">@color/ime_background</item>  
    <item name="android:forceDarkAllowed">false</item>  
</style>  

<style name="TranslucentTheme" parent="@android:style/Theme.DeviceDefault.Light">  
    <item name="android:windowNoTitle">true</item>  
    <item name="android:windowIsTranslucent">true</item>  
    <item name="android:colorEdgeEffect">#333333</item>  
    <item name="android:windowBackground">@null</item>  
    <item name="android:forceDarkAllowed">false</item>  
</style>

预期结果:

ok

实际结果:

爆炸

叫更新 compileSdkVersion 28 到 compileSdkVersion 29

呵呵呵呵呵呵

bug描述:

离线打包
AAPT: error: style attribute 'android:attr/forceDarkAllowed' not found.
AAPT: error: style attribute 'android:attr/forceDarkAllowed' not found.
AAPT: error: style attribute 'android:attr/forceDarkAllowed' not found.
AAPT: error: style attribute 'android:attr/forceDarkAllowed' not found.
AAPT: error: style attribute 'android:attr/forceDarkAllowed' not found.
AAPT: error: style attribute 'android:attr/forceDarkAllowed' not found.

<style name="DCloudTheme" parent="Theme.AppCompat.Light.NoActionBar">  
    <item name="android:windowNoTitle">true</item>  
    <item name="android:colorEdgeEffect">#333333</item>  
    <item name="android:windowBackground">@color/ime_background</item>  
    <item name="android:forceDarkAllowed">false</item>  
</style>  

<style name="TranslucentTheme" parent="@android:style/Theme.DeviceDefault.Light">  
    <item name="android:windowNoTitle">true</item>  
    <item name="android:windowIsTranslucent">true</item>  
    <item name="android:colorEdgeEffect">#333333</item>  
    <item name="android:windowBackground">@null</item>  
    <item name="android:forceDarkAllowed">false</item>  
</style>
2021-03-29 19:43 负责人:无 分享
已邀请:
a***@qq.com

a***@qq.com

compileSdkVersion 29
minSdkVersion 21
targetSdkVersion 28
也没有问题,估计关键是compileSdkVersion为29

7***@qq.com

7***@qq.com (作者)

配置都是ok的

更新 compileSdkVersion 28 到 compileSdkVersion 29

就没有这个报错 但是项目不支持29

7***@qq.com

7***@qq.com (作者)

Task :app:processDebugResources FAILED
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"C:\Users\wl\.gradle\caches\transforms-2\files-2.1\2b31a6b5135f3ee2048c20b76de0d8a1\jetified-lib.5plus.base-release\res\values\values.xml","position":{"startLine":73,"startColumn":4,"startOffset":4833,"endLine":78,"endColumn":12,"endOffset":5164}}],"original":"C:\Users\wl\.gradle\caches\transforms-2\files-2.1\2b31a6b5135f3ee2048c20b76de0d8a1\jetified-lib.5plus.base-release\res\values\values.xml:74:5-79:13: AAPT: error: style attribute 'android:attr/forceDarkAllowed' not found.\n ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"C:\Users\wl\.gradle\caches\transforms-2\files-2.1\2b31a6b5135f3ee2048c20b76de0d8a1\jetified-lib.5plus.base-release\res\values\values.xml","position":{"startLine":116,"startColumn":4,"startOffset":7199,"endLine":122,"endColumn":12,"endOffset":7587}}],"original":"C:\Users\wl\.gradle\caches\transforms-2\files-2.1\2b31a6b5135f3ee2048c20b76de0d8a1\jetified-lib.5plus.base-release\res\values\values.xml:117:5-123:13: AAPT: error: style attribute 'android:attr/forceDarkAllowed' not found.\n ","tool":"AAPT"}

Execution failed for task ':app:processDebugResources'.

A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Android resource linking failed
C:\Users\wl.gradle\caches\transforms-2\files-2.1\2b31a6b5135f3ee2048c20b76de0d8a1\jetified-lib.5plus.base-release\res\values\values.xml:74:5-79:13: AAPT: error: style attribute 'android:attr/forceDarkAllowed' not found.

DCloud_Android_ST

DCloud_Android_ST

硬性要求 compileSdkVersion更新到29。后续就会要求30了

  • 7***@qq.com (作者)

    。。。。。

    2021-03-29 20:04

千图万码

千图万码 - 无码为码

不知道在哪里看到一条信息
build.gradle配置里面
compileSdkVersion 29
minSdkVersion 26
targetSdkVersion 26

就解决这个题了,目前的3.1.18可以支持到29的,最小26

我就是这么解决的

9***@qq.com

9***@qq.com

太多坑了

a***@live.cn

a***@live.cn

compileSdkVersion 32
minSdkVersion 29
targetSdkVersion 32

一直报这个问题,有没有解决的

要回复问题请先登录注册