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

"Invalid resource directory name" Error #88

Closed
afaucogney opened this issue Sep 28, 2020 · 11 comments
Closed

"Invalid resource directory name" Error #88

afaucogney opened this issue Sep 28, 2020 · 11 comments
Labels
bug Something isn't working

Comments

@afaucogney
Copy link

Hello,

I was setting a project with multi modules to help solving #77.

I just created a project with AS 4.1, added EasyLauncher and I get this error:

> Task :app:mergeDebugResources FAILED
AGPBI: {"kind":"error","text":"Invalid resource directory name","sources":[{"file":"/Users/afaucogney/AndroidStudioProjects/MyApplication/app/build/generated/easylauncher/res/debug/drawable-v24-ldpi"}],"tool":"Resource and asset merger"}

I tried with 3.3 and 3.5.

Here is the project https://github.com/afaucogney/multimodule-easylauncher

I will then update with multi module configuration

@issue-label-bot issue-label-bot bot added the bug Something isn't working label Sep 28, 2020
@issue-label-bot
Copy link

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.65. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

@mateuszkwiecinski
Copy link
Member

mateuszkwiecinski commented Sep 28, 2020

Huh, I thought I fixed that one :/ I'll take another look. As a temporary workaround you can move ic_launcher_foreground.xml to unqualified drawable folder.
Thanks for reporting that!

@mateuszkwiecinski
Copy link
Member

mateuszkwiecinski commented Sep 28, 2020

I have tried, but I wasn't able to reproduce the issue on the recent plugin version. I forked your repository and while it indeed fails on 3.3.0 with mentioned issue, it doesn't on 3.5.0
mateuszkwiecinski/multimodule-easylauncher#1
image
It might be needed to run ./gradlew :app:clean to remove invalid resource and let newer plugin version to regenerate the icon.

@mateuszkwiecinski
Copy link
Member

Fixed by #81

@afaucogney
Copy link
Author

@mateuszkwiecinski sory for being late. I just updated my project, with the latest version, but it doesn't worked as expected. Could you please have a look ?

So I added the icon_name, bit the ribon is not applied ! Did I missed something ?

https://github.com/afaucogney/multimodule-easylauncher

@mateuszkwiecinski
Copy link
Member

mateuszkwiecinski commented Nov 5, 2020

Hello again @afaucogney 👋
You applied the plugin to your app module instead of the library module you have the icon declared in. If you apply the plugin to your uikit module the ribbon will show up:
image

@afaucogney
Copy link
Author

afaucogney commented Nov 5, 2020

Thanks for helping @mateuszkwiecinski, but unfortunately, the flavours are bot defined in the lib.

Imagine the projet for a multi-brand app:

In Gradle configuration

  • app
    • buildType debug / release
    • flavor
      • env dev, staging, prod
      • push dev, prod
      • brand brand1, brand2

In Gradle dependencies:

  • implementationBrand1(:uikit-brand1)
  • implementationBrand2(:uikit-brand2)

In projects modules:

  • module doesn't own any launcher icons
  • modules brand1, and brand2 own the same launcher icons names.

But this at the app level, that I want to apply ribon depending on configuration. Then this is the module selection that will select the good icon.

Come back to me if this is not 100% clear. Then I can update my project with a similar config. But before, you should tell me this is more or less feasible.

Greetings.

@mateuszkwiecinski
Copy link
Member

I'm sorry. but I don't fully understand you mesage, I didn't get neither the dependencies nor what you're trying to achieve, what is the expected output. From my understanding your setup heavily relies on an assumption that all feature modules declare the same icon resource name. It is not a reliable assumption for the plugin 🤔
The plugin cannot modify resources declared in other modules, so basically to make the plugin work you have to keep android:icon in the same module as the icon resource and apply the plugin in corresponding build.gradle

@afaucogney
Copy link
Author

. From my understanding your setup heavily relies on an assumption that all feature modules declare the same icon resource name. It is not a reliable assumption for the plugin
Yes

Let's give you a more concrete example:
Imagine I'm building an app for the Volkwagen Group. They want an app for Audi, VW and Skoda. Same behaviour of the app, but different endpoint. We want to be able to build 3 different branded apps, with 2 buildType : Release/Debug, with 2 web-service environment flavour : Prod / Staging. This does means 3 * 2 * 2 = 12 different app configuration, but with only 3 different icons (one by brand)

Every brand ui resources (color, launcher icon ... ) is setup in a specific android module named ui-kit-$brandName, that own ofcourse the ic_launcher icon resource.

Every ui-kit module does only have 2 buildType (debug, release), no Flavours

From the app, I want to be able to add a ribbon if the buildType is debug, but the icon retrieved from the selected ui-kit must be automatically retrieved from the brand favour selection.

When you sync Gradle, only a single module is available. However it is is the module. Again the flavor I want to use to setup easylauncher are in the app.

Is this more clear ?

@afaucogney
Copy link
Author

@mateuszkwiecinski Did you had the chance to have a look on my topic ?

@mateuszkwiecinski
Copy link
Member

Hey @afaucogney 👋 Sorry for the long waiting.
As per my understanding the plugin can't support your case as it don't have access to resources owned by a different module than the plugin was applied to.
If you want you can create a sample repository that resembles your case and I'll try to figure something out :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants