Android 资源链接失败 Android Studio 3.3

标签 android android-gradle-plugin drawable xml-drawable

我收到这个错误

"Android resource linking failed C:\Users\xervice111\AndroidStudioProjects\ud843-QuakeReport-starting-point\app\src\main\res\layout\list_item.xml:10: error: resource drawable/magnitude_circle (aka com.example.android.quake

report:drawable/magnitude_circle) not found. error: failed linking file resources."

This is the error在我添加了一个名为“magnitudeCircle.xml”的可绘制资源文件之后。我已经完成了清理项目、重建项目、使无效并重新启动等操作,但错误仍然存​​在......

This is my magnitubeCircle.xml file

<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!-- Background circle for the magnitude value -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">
    <solid android:color="@color/magnitude1" />
    <size
        android:width="36dp"
        android:height="36dp" />
    <corners android:radius="18dp" />
</shape>

最佳答案

试试这个

<?xml version="1.0" encoding="utf-8"?>

<!-- Background circle for the magnitude value -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">
    <solid android:color="@color/magnitude1" />
    <size
        android:width="36dp"
        android:height="36dp" />
    <corners android:radius="18dp" />
</shape>

关于Android 资源链接失败 Android Studio 3.3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55233580/

相关文章:

android - 无法解析 R [无 admob]

android - 多种口味到位时的 Gradle 复制任务

Android:覆盖应用程序中的可绘制滚动条

android - Android 应用程序中的图像

ListView 内的 Android WebView

java - 如何在android中对字符串数组进行排序并绑定(bind)在数组列表中

android - 如何在中心垂直位置显示自定义布局警报对话框

android studio 找不到指定的文件

Android Wear 项目 Gradle 同步失败

java - 在 TextView 文本之间添加两个空格