You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know that this is not a very important flow for you, but I like the plugin and tend to use it in all multiplatform-related pet projects.
I tried to create the project where there is no need for Android app, so I did not apply any Android plugins, and there were multiple issues with this setup.
FAILURE: Build failed with an exception.
* Where:
Build file '[...]/common/build.gradle.kts' line: 3
* What went wrong:
An exception occurred applying plugin request [id: 'dev.icerock.mobile.multiplatform-resources']
> Failed to apply plugin 'dev.icerock.mobile.multiplatform-resources'.
> Could not create plugin of type 'MultiplatformResourcesPlugin'.
> Could not generate a decorated class for type MultiplatformResourcesPlugin.
> com/android/build/gradle/BaseExtension
Unfortunately since BaseExtension isn't in gradle-api part of AGP, nothing can be done with this, apart from maybe mentioning that you have to add com.android.tools.build:gradle to your buildscript classpath even if you don't do Android.
The module where the generation is happening still needs Android plugin applied.
Without the plugin, I don't even see the Moko-resources tasks section of ./gradlew :common:tasks, so they don't get registered.
Also, as soon as you add Android plugin to the project, Kotlin Multiplatform plugin starts requiring android() target, as it crashes when resolving jvmCompileClasspath without the target.
I don't know how much do you depend on AGP for your resource generation part, but it would be nice to be able to generate resources when Android plugin is not present (of course skipping Android-related generation altogether).
After these additions, everything starts working as intended.
Fortunately, my desktop module (which uses JVM Kotlin plugin, not multiplatform one) doesn't require Android plugin applied. Either moko-resources doesn't require Android plugin when there are no resources to be generated (though I believe the plugin is still needed to consume resources from dependency), or moko-resources doesn't require Android plugin when Kotlin JVM plugin is used instead of Kotlin Multiplatform one (I didn't check that).
So to sum up everything above, is there a chance that dependency on AGP for resource generation can become optional?
The text was updated successfully, but these errors were encountered:
I know that this is not a very important flow for you, but I like the plugin and tend to use it in all multiplatform-related pet projects.
I tried to create the project where there is no need for Android app, so I did not apply any Android plugins, and there were multiple issues with this setup.
One has to add AGP to buildscript classpath in any case. If you don't, you get the following:Unfortunately sinceBaseExtension
isn't ingradle-api
part of AGP, nothing can be done with this, apart from maybe mentioning that you have to addcom.android.tools.build:gradle
to your buildscript classpath even if you don't do Android.Without the plugin, I don't even see the
Moko-resources tasks
section of./gradlew :common:tasks
, so they don't get registered.Also, as soon as you add Android plugin to the project, Kotlin Multiplatform plugin starts requiring
android()
target, as it crashes when resolvingjvmCompileClasspath
without the target.I don't know how much do you depend on AGP for your resource generation part, but it would be nice to be able to generate resources when Android plugin is not present (of course skipping Android-related generation altogether).
Obvious workaround is to add
common/build.gradle.kts
common/main/AndroidManifest.xml
After these additions, everything starts working as intended.
Fortunately, my desktop module (which uses JVM Kotlin plugin, not multiplatform one) doesn't require Android plugin applied. Either moko-resources doesn't require Android plugin when there are no resources to be generated (though I believe the plugin is still needed to consume resources from dependency), or moko-resources doesn't require Android plugin when Kotlin JVM plugin is used instead of Kotlin Multiplatform one (I didn't check that).
So to sum up everything above, is there a chance that dependency on AGP for resource generation can become optional?
The text was updated successfully, but these errors were encountered: