I am new to Android dev and am working on my first app. I have been running into trouble trying to get an image view set up with my own image (stock photos on studio are working fine), and am getting the following error:
AAPT: error: '/home/joshua/AndroidStudioProjects/WSC/app/src/main/res/mipmap-xxxhdpi/wsc_foreground.png' is incompatible with attribute src (attr) reference|color.
I have researched around to even try to understand what this error is saying, and I think it is having trouble linking some file/resource?
I uploaded a .jpg using the add image asset option in android studio. I added a color background to the image, which was a hex number I selected.
I am not getting any errors or warnings until I build, at which point the build fails.
**Can someone please explain:
- What this error means.
- How to troubleshoot this.
- Where my mistake lies.**
I have attached the (hopefully sufficiently) relevant XML code.
Here is the image view inside of my fragment_first.xml, which is inside layout:
<ImageView
android:id="@+id/wsc_image"
android:layout_width="930dp"
android:layout_height="585dp"
android:layout_marginTop="44dp"
android:contentDescription="@string/wsc_image_description"
android:src="/home/joshua/AndroidStudioProjects/WSC/app/src/main/res/mipmap-xxxhdpi/wsc_foreground.png"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/textview_first"
app:layout_constraintStart_toStartOf="@+id/textview_first"
app:layout_constraintTop_toBottomOf="@+id/textview_first"
app:layout_constraintVertical_bias="0.0" />
I don't have an XML for the wsc_foreground.png, but do have a wsc.xml. I tried adding the full path in the wsc.xml for wsc_foreground.png, but this did not change anything.
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/wsc_background"/>
<foreground android:drawable="/home/joshua/AndroidStudioProjects/WSC/app/src/main/res/mipmap-xxxhdpi/wsc_foreground.png"/>
</adaptive-icon>
My apologies if this is a dumb question and/or not clear. Please let me know in the comments if I need to clarify any of this.
Thanks!