'org.xmlpull.v1.XmlPullParserException: unterminated entity ref (position:TEXT PNG) error

I have to create a splash screen and trying it according to guides this, and this.

When I create layout/launch_screen.xml and put there this code, it appears inside design in Android Studio correctly, but generates error

org.xmlpull.v1.XmlPullParserException: unterminated entity ref (position:TEXT PNG)

Full code to @layout/launch_screen this:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#652D6C"
    android:gravity="center_vertical"
    android:orientation="vertical">


    <ImageView
        android:id="@+id/imageView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"

        app:srcCompat="@mipmap/launch_screen"
        android:contentDescription="@string/image_description"/>
</LinearLayout>

Full error log here:

    org.xmlpull.v1.XmlPullParserException: unterminated entity ref 
    (position:TEXT PNG   IHDR...@4:50 in 
    java.io.InputStreamReader@5fc473ec)     at org.kxml2.io.KXmlParser.exception  
    at org.kxml2.io.KXmlParser.error  
    at org.kxml2.io.KXmlParser.pushEntity  
    at org.kxml2.io.KXmlParser.pushText  
    at org.kxml2.io.KXmlParser.nextImpl  
    at org.kxml2.io.KXmlParser.next  at 
 com.android.layoutlib.bridge.android.BridgeXmlBlockParser.next(BridgeXmlBlockParser.java:302)   
    at 
 com.android.layoutlib.bridge.impl.ResourceHelper.getInternalComplexColor(ResourceHelper.java:170)   
    at com.android.layoutlib.bridge.impl.ResourceHelper.getColorStateList(ResourceHelper.java:222)   
    at android.content.res.Resources_Delegate.getColorStateList(Resources_Delegate.java:262)
    at android.content.res.Resources.getColorStateList(Resources.java:1017)
    at android.content.Context.getColorStateList(Context.java:621)
    at android.support.v7.content.res.AppCompatResources.getColorStateList(AppCompatResources.java:65)
    at android.support.v7.widget.TintTypedArray.getColorStateList(TintTypedArray.java:171)
    at android.support.v7.widget.AppCompatImageHelper.loadFromAttributes(AppCompatImageHelper.java:71)
    at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:78)
    at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:68)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:720) 
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:788) 
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)    
    at 
    android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:863) 
    at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72)
    at 
    android.view.LayoutInflater.rInflate(LayoutInflater.java:837)    
    at 
    android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)     at android.view.LayoutInflater.inflate(LayoutInflater.java:515)   at 
    android.view.LayoutInflater.inflate(LayoutInflater.java:394) Copy 
    stack to clipboard 

Not that I have mipmap folder for pngs, and also created @drawable/launch_screen.xml but it seems to be unused now.

My splash for now appearing only background color but not rendering png as it should.



Solution 1:[1]

Try using android.support.v7.widget.AppCompatImageView instead of ImageView like this:

<android.support.v7.widget.AppCompatImageView
    android:id="@+id/imageView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"

    app:srcCompat="@mipmap/launch_screen"
    android:contentDescription="@string/image_description"/>

Solution 2:[2]

What it tells you is that the Parser has received in a possibly long text field On line 4 in position 50 of the XML there is a strange character, possibly the character '&'

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 João Fernandes
Solution 2 ifatou