Harsha Bhadra
Harsha Bhadra

Reputation: 331

Android resource linking failed Android studio 3.3

I am getting this error

"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 errorAfter I added a drawable resource file named "magnitudeCircle.xml". I have done things like clean project, rebuild project, Invalidate and restart etc but the error is still there ...

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>

Upvotes: 4

Views: 11955

Answers (6)

chikadance
chikadance

Reputation: 4167

In my case, it's because wrong drawable xml

error drawable xml:

<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">\

when i change to:

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

it fix

Upvotes: 0

barondaz
barondaz

Reputation: 1

Remove this line from your xml:

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

If not work, creat new folder 'drawable-v28(your version)' and then copy the xml file from 'drawable' to it. Hope it works for you.

Upvotes: 0

Nevil Ghelani
Nevil Ghelani

Reputation: 727

I think the problem is in your "list_item.xml" file. Error is at 10th line of list_item.xml file. builder cannot find "drawable/magnitude_circle" item from your project. So,

1) If you didn't add "magnitude_circle" file in your drawable resource file yet than first add that file into drawable and then try to build project.

2) If you already have that file in drawable then replace drawable/magnitude_circle into @drawable/magnitude_circle

Upvotes: 0

Abhinav Gupta
Abhinav Gupta

Reputation: 2265

This error belongs to this line:

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

because we can not use this tag twice in a single file<click here>.

So, remove this line and try this below code :

<?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>

Upvotes: 0

Mehul Kabaria
Mehul Kabaria

Reputation: 6622

Try with Remove one line from your xml

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

There are two import line in your xml.

Upvotes: 0

VIISHRUT MAVANII
VIISHRUT MAVANII

Reputation: 12678

Try This

<?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>

Upvotes: 1

Related Questions