资源链接失败/ Android Studio College Project

时间:2019-02-22 14:05:10

标签: android error-handling

我一直在尝试构建该项目,但是在构建该项目时我一直面临问题,有人可以帮助我吗?

下面的代码

    <?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="Base.Theme.AppCompat" parent="Base.V26.Theme.AppCompat"/>
    <style name="Base.Theme.AppCompat.Light" parent="Base.V26.Theme.AppCompat.Light"/>
    <style name="Base.V26.Theme.AppCompat" parent="Base.V23.Theme.AppCompat">
        <!-- We can use the platform styles on API 26+ -->
        <item name="colorError">?android:attr/colorError</item>
    </style>
    <style name="Base.V26.Theme.AppCompat.Light" parent="Base.V23.Theme.AppCompat.Light">
        <!-- We can use the platform styles on API 26+ -->
        <item name="colorError">?android:attr/colorError</item>
    </style>
    <style name="Base.V26.Widget.AppCompat.Toolbar" parent="Base.V7.Widget.AppCompat.Toolbar">
        <item name="android:touchscreenBlocksFocus">true</item>
        <item name="android:keyboardNavigationCluster">true</item>
    </style>
    <style name="Base.Widget.AppCompat.Toolbar" parent="Base.V26.Widget.AppCompat.Toolbar"/>
</resources>

colors.xml文件在

下面
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="colorPrimary">#000000</color>
    <color name="colorPrimaryDark">#000000</color>
    <color name="colorAccent">#FF4081</color>
</resources>

我得到的错误在下面

Android resource linking failed
/Users/arsalan/Downloads/Development/Pixlr/app/build/intermediates/incremental/mergeEditerDebugResources/merged.dir/values-v26/values-v26.xml:7: error: resource android:attr/colorError not found.
/Users/arsalan/Downloads/Development/Pixlr/app/build/intermediates/incremental/mergeEditerDebugResources/merged.dir/values-v26/values-v26.xml:11: error: resource android:attr/colorError not found.
/Users/arsalan/Downloads/Development/Pixlr/app/build/intermediates/incremental/mergeEditerDebugResources/merged.dir/values-v26/values-v26.xml:15: error: style attribute 'android:attr/keyboardNavigationCluster' not found.
error: failed linking references.

有人可以帮助我吗,我必须将此项目提交给我的大学。系统配置也位于下面-

计算机型号-Macbook Air 2018(256GB) 软件模型-Android Studio 3.3(内部版本#AI-182.5107.16.33.5199772) JRE-1.8.0_152-release-1248-b01 x86_64 JVM-JetBrains s.r.o的OpenJDK 64位服务器VM 操作系统版本-macOS 10.14.2

1 个答案:

答案 0 :(得分:0)

确保在build.gradle中至少使用api级别26 编译版本26 buildToolsVersion '26 .0.2'