I am getting error while building apk with gradle 7.6.
I’m using lemur and lemur proto.
Error-
Execution failed for task ':app:mergeDebugJavaResource'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction
> 2 files found with path 'com/simsilica/lemur/style/base/glass-styles.groovy' from inputs:
- /.gradle/caches/modules-2/files-2.1/com.simsilica/lemur-proto/1.13.0/9163fc6865f204de84baac90b57820df86d5fe95/lemur-proto-1.13.0.jar
- /.gradle/caches/modules-2/files-2.1/com.simsilica/lemur/1.16.0/8e4af305c8c00dde11db8d76be8debd5ee751c09/lemur-1.16.0.jar
You cannot have a duplicate of folders inside your Android APK, they won’t merge, you need to create a delete Gradle task to delete one folder or a move task to merge their contents manually and call it before mergeDebug task.
Android doesn’t like the way lemur allows each library to have additions to the same style just by including the same style file. Android sees this as duplicate resources.
So on Android you have to exclude these files (and lose the default glass styling) and either create your own style or hand-merge the files together into your own glass style.
If you use the glass style then ListBox, Selector, Spinner, and maybe some others will not be styled properly if you remove the style file from Lemur-proto.
glass-style is written in Groovy script and will be compiled at runtime. Afaik Android does not support runtime compilation of groovy scripts so you need to precompile them or rewrite them in pure java code.
(I have precompiled them, let me know if you need the jar, but have not tested it on Android yet;)