Skip to content

error CS7069: Reference to type 'ILifecycleOwner' claims it is defined in 'Xamarin.AndroidX.Lifecycle.Common', but it could not be found #909

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tuyen-vuduc opened this issue Jun 21, 2024 · 1 comment · Fixed by #908

Comments

@tuyen-vuduc
Copy link
Contributor

Android application type

Android for .NET (net6.0-android, etc.)

Affected platform version

VS 2022 17.10.2

Description

I am trying to update my binding library for SceneView. However, there is an issue with Xamarin.AndroidX.Lifecycle.Common v2.8.2.

error CS7069: Reference to type 'ILifecycleOwner' claims it is defined in 'Xamarin.AndroidX.Lifecycle.Common', but it could not be found

Steps to Reproduce

Prerequites: .NET8, Java 17

  1. Clone repo at branch feat/scence-view-2.2.1
  2. Run sh bind.sh --artifact io.github.sceneview:sceneview:2.2.1
  3. Wait and see the error

Did you find any workaround?

Nope

Relevant log output

error CS7069: Reference to type 'ILifecycleOwner' claims it is defined in 'Xamarin.AndroidX.Lifecycle.Common', but it could not be found
@jpobst
Copy link
Contributor

jpobst commented Jun 21, 2024

#908

jpobst added a commit that referenced this issue Jun 27, 2024
Context: #863
Fixes: dotnet/android#9049
Fixes: #909

In version `2.8.*`, Google moved all the types in 2 libraries into 2 new libraries:
- `Xamarin.AndroidX.Lifecycle.Common` to `Xamarin.AndroidX.Lifecycle.Common.Jvm`.  
- `Xamarin.AndroidX.Lifecycle.ViewModel` to `Xamarin.AndroidX.Lifecycle.ViewModel.Android`.  

While this is a source compatible change for users, it is not a binary compatible change for users that are relying on NuGets or assemblies that have not been recompiled.

These types may continue to work in Debug builds, but the linker and AOT compiler steps run for Release builds are unable to resolve the moved types, causing unfixable errors (other than recompiling all assemblies).

Adding `[TypeForwardedToAttribute]` attributes allows the linker and AOT to succeed without recompiling old assemblies.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants