this post was submitted on 30 Oct 2024
12 points (83.3% liked)

Programming

17450 readers
61 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS
 

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.

you are viewing a single comment's thread
view the rest of the comments
[–] JackGreenEarth@lemm.ee 2 points 2 weeks ago (1 children)

Tap for Kotlin script

plugins { alias(libs.plugins.android.application) alias(libs.plugins.kotlin.android) }

android { namespace = "org.jackgreenearth.materialmusic" compileSdk = 35

defaultConfig {
    applicationId = "org.jackgreenearth.materialmusic"
    minSdk = 30
    targetSdk = 35
    versionCode = 1
    versionName = "1.0"

    testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
    release {
        isMinifyEnabled = false
        proguardFiles(
            getDefaultProguardFile("proguard-android-optimize.txt"),
            "proguard-rules.pro"
        )
    }
}
compileOptions {
    sourceCompatibility = JavaVersion.VERSION_17
    targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
    jvmTarget = "1.8"
}
buildFeatures {
    viewBinding = true
}

}

dependencies {

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.material)
implementation(libs.androidx.constraintlayout)
implementation(libs.androidx.navigation.fragment.ktx)
implementation(libs.androidx.navigation.ui.ktx)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
implementation(libs.androidx.vectordrawable)
implementation(libs.androidx.vectordrawable.animated)

}

[–] Deckweiss@lemmy.world 2 points 2 weeks ago* (last edited 2 weeks ago) (1 children)

I'll look into it on the weekend in detail if nobody else can spot the issue until then.

So far, everything looks normal and I didn't see anything in the log at a glance. (besides a bunch of res related warnings that I am not sure about)

Are the images in your res folder / do you see them when you go to View > Tool Windows > Resource Manager ?

[–] JackGreenEarth@lemm.ee 2 points 2 weeks ago

I do see them when I go to the resource manager