Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mipmaps in submodule #288

Open
mtrakal opened this issue Mar 11, 2022 · 4 comments
Open

mipmaps in submodule #288

mtrakal opened this issue Mar 11, 2022 · 4 comments

Comments

@mtrakal
Copy link

mtrakal commented Mar 11, 2022

Hi, I just updated from

plugins {
    id "com.starter.easylauncher" version "4.2.0"

to version 5.0.0


easylauncher {
    // https://github.com/usefulness/easylauncher-gradle-plugin
    productFlavors {
        staging {
            filters = chromeLike(label: "staging", font: "DejaVuSans")
        }
        demo {
            filters = chromeLike(label: "demo", font: "DejaVuSans")
        }
        security {
            filters = chromeLike(label: "security", font: "DejaVuSans")
        }
    }
    buildTypes {
        debug {
            filters = customRibbon(font: "DejaVuSans", ribbonColor: "#99606060")
        }
        distribution {
            filters = customRibbon(font: "DejaVuSans", ribbonColor: "#99FF7600")
        }
        release {}
    }
    variants {
        productionDebug {
            // OVERRIDE all previous filters defined for `productionDebug` variant
            filters = [customRibbon(label: "debug", font: "DejaVuSans", ribbonColor: "#99FF0000"), chromeLike(label: "PROD", ribbonColor: "#f44141", font: "DejaVuSans")]
        }
    }
}

Using Windows, build variant: stagingDebug, but it don't show any overlay, just standard icon.

I testing on Google Pixel 3a, Android 12L now / Xiaomi MI8; Andoid 10. Same result on both.

If I removed font, result is same.

compileSdkVersion 32
ext.kotlin_version = '1.6.10'
classpath 'com.android.tools.build:gradle:7.1.2'
distributionUrl=https://services.gradle.org/distributions/gradle-7.4-all.zip

@mtrakal
Copy link
Author

mtrakal commented Mar 11, 2022

edit: it's because I moved mipmaps to separate module from app module

@mtrakal
Copy link
Author

mtrakal commented Mar 11, 2022

steps to reproduce:

/app - implementation project(":common") - app module with kotlin code only - no resources
/common - implementation(project(":common-assets")) just merge more common modules
/common-assets - only reources, included application launcher icon in mipmaps, no code

/common-assets contains application mipmaps / launcher icon.

In this case EasyLauncher is not able to show overlay texts over Launcher icon.

When I moved /mipmaps folder back to /app module, plugin start working again.

@mtrakal mtrakal changed the title 5.0.0 don't work mipmaps in submodule Mar 11, 2022
@mateuszkwiecinski
Copy link
Member

Yeah, unfortunately that's an expected behaviour. The plugin cannot access files outside the module it was applied to. That's by design, otherwise you'd open yourself to Gradle caching issues. If you tried to work around the limitation and tried to work with merged resources, it's not going to be possible as merging resources happens too late, after the plugin can manipulate resources.
Basically, it's technically impossible to touch files outside the current project (or at least that's my understanding).

So either project(":common-assets") has to have your build flavors defined plus the plugin has to be applied to the library module, or application icons have to be placed within the module that defines the application (where the com.android.application plugin is applied).

Do I understand correctly "no resources" in "app module with Kotlin code only - no resources" means no resources manually added to the project, but all Android Framework resources, all generated resources and all merged resources are still present there? It's not a purely Kotlin-only module, right?
Can you describe your use case? What was the motivation to application icons outside the application module?

@mtrakal
Copy link
Author

mtrakal commented Mar 14, 2022

"no resources" I mean standard Android app project/module (com.android.application) with no own manually added resources. All Android Framework resources added + merged all resources from common-assets while compiling.

But my fault, to be clear I just moved colors/drawable/shapes/etc but layouts and strings are still present, so not all resources are gone.

Use case is to split one huge monolith app into modules + possibility to reuse company branding (resources) in other apps when it will be necessary.

As a workaround, I moved mipmaps back to /app module and it works as expected again.

I expected, when I can use resources in layouts/kotlin code in main /app module, that easylauncher will be able to touch this mipmaps too :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants