Is it possible to generate Android resources from ...
# kotlin-toolchain
f
Is it possible to generate Android resources from a plugin?
Copy code
generated:
  resources:
    - directory: ${tasks.generate.action.generatedResourcesFolder}
doesn’t seem to register it as an Android resource directory or something, it doesn’t get detected by aapt2:
Copy code
Caused by: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
dev.fishies.fishcatcher.androidApp-androidApp-50:/mipmap-anydpi-v26/ic_launcher.xml:3: error: resource drawable/background (aka dev.fishies.fishcatcher:drawable/background) not found.
dev.fishies.fishcatcher.androidApp-androidApp-50:/mipmap-anydpi-v26/ic_launcher.xml:4: error: resource drawable/icon_colored (aka dev.fishies.fishcatcher:drawable/icon_colored) not found.
dev.fishies.fishcatcher.androidApp-androidApp-50:/mipmap-anydpi-v26/ic_launcher.xml:5: error: resource drawable/icon_monochrome (aka dev.fishies.fishcatcher:drawable/icon_monochrome) not found.
error: failed linking file resources.
even though the resources are in the directory
progress 1
j
@Anton Prokhorov could you please check this? And maybe open a feature request if we don't support it yet?
a
Hi, @fishy No, it isn’t possible at the moment, let me create an issue to follow, cc @Fedor Ihnatkevich
👍 2
f
Is there a good workaround? Can I generate the files into the module’s source directory instead?
🤔 1
f
No, sadly no workaround, certainly no good workaround. Generating files into source directories is always a bad idea, and I'm not sure we even allow this.
Plugins are a preview for now, but we record all the feedback and missing things, so we'll be able to stabilise the feature. So thanks for the report!
a