cross-posted from: https://lemm.ee/post/46066494

I followed the recommended processes for adding images to my app, and it is being displayed correctly on the layout preview, but not at all on the app. I have vector assets, webp, png images, but none are being displayed.

The project is too big to put here in its entirety, but please ask for any snippets that could help you solve the issue. I’ve tried searching the web and asking LLMs and neither could help, so please help me, fellow humans.

  • tronx4002@lemmy.world
    link
    fedilink
    English
    arrow-up
    4
    ·
    19 days ago

    Is it not showing up in the emulator, or the phone on which the app is downloaded, or both?

    • JackGreenEarth@lemm.eeOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      19 days ago

      The laptop is not powerful enough to run an emulator, but it shows up on the layout preview but not any of the 3 physical devices I’ve tested it on

          • tronx4002@lemmy.world
            link
            fedilink
            English
            arrow-up
            2
            ·
            edit-2
            18 days ago

            Type package:mine level:error in the text bar and see if any errors are returned.

            And what is the path of your image, and how are you placing the image in your xml file? Here is an example of one that works for me with an image that is located in the res/drawable/baseline_arrow_back_24.xml package

              <ImageView
                    android:id="@+id/backButton"
                    android:layout_width="42dp"
                    android:layout_height="42dp"
                    android:layout_gravity="start"
                    android:layout_centerVertical="true"
                    android:src="@drawable/baseline_arrow_back_24"
                    android:contentDescription="@string/back_arrow" />
            
              • tronx4002@lemmy.world
                link
                fedilink
                English
                arrow-up
                2
                ·
                18 days ago

                I would try app:src or adding

                 android {  
                   defaultConfig {  
                     vectorDrawables.useSupportLibrary = true  
                    }  
                

                To your build.gradle