Error:Android resource linking failed

Android Studio升级3.2以后会出现3.0版本前没出现的个别问题,

错误信息:

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

 

1.初步:(未解决上述问题)

在项目根目录下的gradle.properties文件(如果没有,新建)中添加以下配置:

android.enableAapt2=false

清理项目,重新编译,问题依然未解决。

 

2.结合项目中的解决思路:(这种方式可以解决我遇到的问题)

minSdkVersion = 17
compileSdkVersion = 28
targetSdkVersion = 28

编译版本等用的高版本,引入

implementation "com.android.support:appcompat-v7:$rootProject.supportStableVersion"
implementation "com.android.support:design:$rootProject.supportStableVersion"
implementation "com.android.support:recyclerview-v7:$rootProject.supportStableVersion"

这里引入的是27.0.0 而不是28.+

supportLibraryVersion = '28.0.0'
supportStableVersion = '27.0.0'

目前可以解决当前我遇到的问题,项目编译运行正常。如果对于您遇到的问题依然无法解决,请结合报错信息针对处理。

你可能感兴趣的:(开发笔记_dev)