Repository navigation
Missing method HardwareBuffer.Create(...) #8703
Copy link
Copy link
Closed
Labels
Area: Mono.AndroidIssues with the Android API binding (Mono.Android.dll).Issues with the Android API binding (Mono.Android.dll).bugComponent does not function as intended.Component does not function as intended.
Milestone
Description
Activity
- addedneeds-triageIssues that need to be assigned.Issues that need to be assigned.
on Feb 7, 2024 @jpobst: looking at the build log for
Mono.Android.csproj, I see:bj/Debug/net9.0/android-34/mcw/api-34.xml(32327,10): warning BG8800: Unknown parameter type 'Android.Hardware.HardwareBufferUsage' for member 'Android.Hardware.HardwareBuffer.Create (int, int, Android.Hardware.HardwareBufferFormat, int, Android.Hardware.HardwareBufferUsage)'Looks like a "bad enumification" prevented
HardwareBuffer.create()from being bound. :-/- addedArea: Mono.AndroidIssues with the Android API binding (Mono.Android.dll).Issues with the Android API binding (Mono.Android.dll).and removedneeds-triageIssues that need to be assigned.Issues that need to be assigned.
on Feb 7, 2024 This will be fixed by #8707, however we cannot add new API to the shipped "contract"
net8.0-android. Thus, this will not be available until .NET 9.In the meantime, you should be able to copy the binding for
HardwareBuffer.Create (...)into your project to be able to use it:static readonly JniPeerMembers _members = new XAPeerMembers ("android/hardware/HardwareBuffer", typeof (HardwareBuffer)); public static unsafe Android.Hardware.HardwareBuffer Create (int width, int height, Android.Hardware.HardwareBufferFormat format, int layers, long usage) { const string __id = "create.(IIIIJ)Landroid/hardware/HardwareBuffer;"; try { JniArgumentValue* __args = stackalloc JniArgumentValue [5]; __args [0] = new JniArgumentValue (width); __args [1] = new JniArgumentValue (height); __args [2] = new JniArgumentValue ((int) format); __args [3] = new JniArgumentValue (layers); __args [4] = new JniArgumentValue (usage); var __rm = _members.StaticMethods.InvokeObjectMethod (__id, __args); return global::Java.Lang.Object.GetObject<Android.Hardware.HardwareBuffer> (__rm.Handle, JniHandleOwnership.TransferLocalRef)!; } finally { } }
- changed the title
[-]Where is the static function HardwareBuffer.Create()[/-][+]Missing method `HardwareBuffer.Create(...)`[/+]on Feb 9, 2024 - addedbugComponent does not function as intended.Component does not function as intended.
on Feb 9, 2024 - added a commit that references this issue
on Mar 13, 2024 - locked and limited conversation to collaborators
on Apr 13, 2024
Metadata
Metadata
Assignees
Labels
Area: Mono.AndroidIssues with the Android API binding (Mono.Android.dll).Issues with the Android API binding (Mono.Android.dll).bugComponent does not function as intended.Component does not function as intended.
Android application type
.NET Android (net7.0-android, net8.0-android, etc.)
Affected platform version
VS 2022
Description
I have been trying for a while to figure out how to create an Android HardwareBuffer with Xamarin. With Android, it is easy, we simply need to call HardwareBuffer.Create(), but I cannot find the equivalent in Xamarin. How should I proceed or is this function missing?
Steps to Reproduce
Create a Net 8 Xamarin project using Android.Hardware. Then try to figure out how to call HardwareBuffer.Create()
Did you find any workaround?
No
Relevant log output
No response