当前位置: 首页 > 工具软件 > light-daemon > 使用案例 >

Android resource linking failed Daemon: AAPT2 aapt2-3.2.0-beta03-4818971-windows Daemon #0 ---

姬魁
2023-12-01

Android resource linking failed
Output: error: resource style/Theme.AppCompat.Light.DarkActionBar (aka com.hp.sortfilebysize:style/Theme.AppCompat.Light.DarkActionBar) not found.
E:\ASWorkSpace\SortFileBySize\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:9: error: style attribute ‘attr/colorPrimary (aka com.hp.sortfilebysize:attr/colorPrimary)’ not found.
E:\ASWorkSpace\SortFileBySize\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:10: error: style attribute ‘attr/colorPrimaryDark (aka com.hp.sortfilebysize:attr/colorPrimaryDark)’ not found.
E:\ASWorkSpace\SortFileBySize\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:11: error: style attribute ‘attr/colorAccent (aka com.hp.sortfilebysize:attr/colorAccent)’ not found.
error: failed linking references.

Command: C:\Users\tangdekun.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-beta03-4818971-windows.jar\868db5e9c484c628dee78cdbe6877651\aapt2-3.2.0-beta03-4818971-windows\aapt2.exe link -I
N:\ProgramFiles\android\sdk\platforms\android-28\android.jar
–manifest
E:\ASWorkSpace\SortFileBySize\app\build\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml
-o
E:\ASWorkSpace\SortFileBySize\app\build\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_
-R
@E:\ASWorkSpace\SortFileBySize\app\build\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt
–auto-add-overlay
–java
E:\ASWorkSpace\SortFileBySize\app\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r
–custom-package
com.hp.sortfilebysize
-0
apk
–output-text-symbols
E:\ASWorkSpace\SortFileBySize\app\build\intermediates\symbols\debug\R.txt
–no-version-vectors
Daemon: AAPT2 aapt2-3.2.0-beta03-4818971-windows Daemon #0


解决方法:
Android studio升级到3.0以上,工程自动会引入Androidx的相关包,当因为某些原因,我们把默认依赖删除以后,就会出现Android resource linking failed,错误日志1是缺少androidx.appcompat:appcompat:1.0.0-alpha1依赖,错误日志2是缺少androidx.constraintlayout:constraintlayout:1.1.2依赖,
错误日志3是因为compileSdkVersion版本不对,应该改为compileSdkVersion 28
解决方案
添加相关依赖即可,如下:

implementation ‘androidx.appcompat:appcompat:1.0.0-alpha1’
implementation ‘androidx.constraintlayout:constraintlayout:1.1.2’


以上都是乱说的
根本原因是特殊符号的转译,即加\。3.2版本之前没有强制要求,3.2版本之后强制要求了。

 类似资料: