-
Notifications
You must be signed in to change notification settings - Fork 531
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
java.time
package not bound in Mono.Android
#8081
Comments
To reproduce: Create a binding library with TargetFramework=net6-android over a .aar having desugaring support (https://developer.android.com/studio/write/java8-support) using: "Microsoft Visual Studio Community 2022 Building the binding library gives below error:
Tried a few things without success:
Thank you for the support |
The The commit from 6 years ago doesn't say why it wasn't bound. I guess we could try it and see what the issues are. Note that this issue is:
|
java.time
package not bound in Mono.Android
@jpobst I'm facing a similar issue, I wonder if there is a work around for this for the time being? Is there some way to bind methods that take |
I think the only thing you can do is write a new Java API that wraps the existing API without exposing Something like: public void doThing (string localDateTime)
{
var dt = LocalDateTime.parse (localDateTime);
doRealThing (dt);
} |
@jpobst Thanks for your response on this, I was thinking something similar, but I was hoping I would not have to rewite the Java API. Do you know of a way I can add a method to the Additions that will do something like this, but on the C# level. So something like:
I don't know if the above makes sense? Do you think this is possible? I don't have access to edit the java source code for the AAR I am trying to bind, that's why I'd prefer a C# based solution. Let me know what you think, and thanks for your respose! :) |
There is no way to do it in C#, unless you try to bind it by hand yourself. (I can't help with that.) If you are using .NET 7+, you can add a loose Note that it will not show up in Intellisense which is quite annoying, but it does work when you run your application: |
Thanks for the response @jpobst, I'm trying to do this now but it's not too clear to he how. Would I add the java file to my Xamarin Android Binding project? Or would I add it to the Xamarin-Android application? If there is a way to do this is in the Android Binding project, do I just add the java file to the Additions folder in that project? it doesn't seem too clear to me what the best way to do it. |
) Fixes: #8081 Context: 571546a When binding API-26 we chose not to bind the `java.time` and `java.time.chrono` Android packages (571546a), likely due to the amount of metadata required to build them correctly. (It also requires the use of `managedOverride`, which didn't exist at the time.) However, they are pretty useful packages, so let's invest the effort to get them bound. Additionally, this results in now producing bindings for many methods in unrelated types that consume `java.time` types.
Originally posted by @4brunu in #5523 (comment)
Still facing the same issue.
The text was updated successfully, but these errors were encountered: