CommunityToolkit / Maui.NativeLibraryInterop

Maui.NativeLibraryInterop is a community-created library of binding samples to help .NET MAUI developers interop with native libraries more easily
MIT License
159 stars 24 forks source link

Runtime Dependencies/Complex Example #41

Open kfrancis opened 1 month ago

kfrancis commented 1 month ago

I've been trying to create a binding for Intercom, but I'm struggling to run it on Android even though it's all building. Can there be a sample that has a deeper dependency tree and includes Android? Right now, the Facebook example is the only Android example but there are no run-time dependencies only compile-time.

Perhaps an example that packs up the work into a plugin? https://github.com/jfversluis/Plugin.Maui.Feature

Links:

kfrancis commented 1 month ago

Started trying to make sense of this here: https://github.com/kfrancis/Plugin.Maui.Intercom

kfrancis commented 1 month ago

Getting closer, able to call initialize but when trying to render the component I'm getting:

Java.Lang.NoClassDefFoundError: 'Failed resolution of: Landroidx/compose/runtime/internal/ComposableLambdaKt;'

Still a mess of dependencies, and the error it's mentioning isn't a direct one but rather transient from one of the material dependencies: https://mvnrepository.com/artifact/io.intercom.android/intercom-sdk-base/15.10.1

2024-08-07-0z7d7

rachelkang commented 5 days ago

Hi, @kfrancis - thanks for using Maui.NativeLibraryInterop and reporting this issue. It appears that you might be missing some dependencies that your binding library of interest requires. In case it is helpful, I have a sample that includes an Android binding with its dependencies at https://github.com/rachelkang/MauiCharts and more information about my process in a blog post .

kfrancis commented 2 days ago

@rachelkang I did check the blog post and your source, but I don't see where my issue lies. I mean, Intercom has many runtime dependencies whereas your project is single-dependency. In particular, the compose dependency seems to be more problematic than others - but I'm not sure where I'm going about it wrong.

https://github.com/kfrancis/Plugin.Maui.Intercom/blob/a5e09782ae77924e350290dba262aeda84a5d9cd/src/Plugin.Maui.Feature/Plugin.Maui.Intercom.csproj#L86

https://github.com/kfrancis/Plugin.Maui.Intercom/blob/a5e09782ae77924e350290dba262aeda84a5d9cd/src/android/native/mauiintercom/build.gradle.kts#L39

Any further suggestions? I put the source on github in the hopes that it might be useful to see what's going on in a far more dependency-complex scenario.