最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

.net - Problem with Jetpack Compose dependencies in a C# Android Binding Library - Stack Overflow

programmeradmin0浏览0评论

I have an Android Library (.aar) built with Android Studio that uses Compose @Composable. I am trying to create an Android Binding Library in Visual Studio to use my Android Library in a MAUI application. But when trying to build the Android Binding Library, dotnet doesn't find "androidxpose.runtime.Composer"

I first tried to copy .aar and .jar dependencies from my Android Studio project, but it didn't work.

I also tried to use AndroidMavenLibrary dependencie for androidxpose.runtime but it wasn't able to download it:
<AndroidMavenLibrary Include="androidxpose.runtime:runtime" Version="1.7.7" Bind="false"></AndroidMavenLibrary>
resulting in a error XA4236 - 404 (Not Found) error
trying to go manually to the google repository also results in a 404 error
pose.runtime/runtime/1.7.7 -> Files -> View all -> 404

Then I saw nugets packages for the dependencies I needed.

Here are the dependencies in my .csproj:

<ItemGroup>
  <PackageReference Include="Xamarin.AndroidX.Annotation" Version="1.9.1.2" />
  <PackageReference Include="Xamarin.AndroidX.Annotation.Experimental" Version="1.4.1.8" />
  <PackageReference Include="Xamarin.AndroidX.Annotation.Jvm" Version="1.9.1.2" />
  <PackageReference Include="Xamarin.AndroidX.Collection.Jvm" Version="1.4.5.2" />
  <PackageReference Include="Xamarin.AndroidX.Compose.Runtime" Version="1.7.6.1" />
  <PackageReference Include="Xamarin.AndroidX.Compose.Runtime.Android" Version="1.7.6.1" />
  <PackageReference Include="Xamarin.AndroidX.Compose.Runtime.LiveData" Version="1.7.6.1" />
  <PackageReference Include="Xamarin.AndroidX.Compose.Runtime.RxJava2" Version="1.7.6.1" />
  <PackageReference Include="Xamarin.AndroidX.Compose.Runtime.Saveable" Version="1.7.6.1" />
  <PackageReference Include="Xamarin.AndroidX.Lifecycle.Runtime.Compose" Version="2.8.7.2" />
  <PackageReference Include="Xamarin.AndroidX.Lifecycle.Runtime.Compose.Android" Version="2.8.7.2" />
  <PackageReference Include="Xamarin.Jetbrains.Annotations" Version="26.0.1.2" />
  <PackageReference Include="Xamarin.Kotlin.StdLib" Version="2.0.21.2" />
  <PackageReference Include="Xamarin.Kotlin.StdLib.Common" Version="2.0.21.2" />
  <PackageReference Include="Xamarin.Kotlin.StdLib.Jdk7" Version="2.0.21.2" />
  <PackageReference Include="Xamarin.Kotlin.StdLib.Jdk8" Version="2.0.21.2" />
  <PackageReference Include="Xamarin.KotlinX.Coroutines.Android" Version="1.9.0.2" />
  <PackageReference Include="Xamarin.KotlinX.Coroutines.Core" Version="1.9.0.2" />
  <PackageReference Include="Xamarin.KotlinX.Coroutines.Core.Jvm" Version="1.9.0.2" />
</ItemGroup>

representing all compose dependencies, their dependencies and even some extra packages.

additional reference: .AndroidX.Compose.Runtime

and here is the error:

The method '[Method] void TestComposable(androidxpose.runtime.Composer $composer, int $changed)' was removed because the Java parameter type 'androidxpose.runtime.Composer' could not be found.

but androidxpose.runtime.Composer should be provided by the Xamarin.Androidx.Compose.Runtime package, according to androidx docs: androidx docs

I don't understand why dotnet build is not able to find the Java class "Composer"

发布评论

评论列表(0)

  1. 暂无评论