dotnet / android

.NET for Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#
MIT License
1.92k stars 525 forks source link

Java DataBinding support #7714

Open DouglasGiovanella opened 1 year ago

DouglasGiovanella commented 1 year ago

Android application type

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

Affected platform version

All

Description

I had opened a feature request on the visual studio feedback site, but in 3 months i didn't receive any feedback :( (https://developercommunity.visualstudio.com/t/Support-for-binding-a-library-that-uses-/10214966)

But to be able to discuss this topic with the community, i'm opening this issue.

We use a paid security third party library that only has Android/iOS native support, but we maintain a Binding for both versions, so was not a problem so far. The problem started some time a go, because they start using DataBinding in their Android SDK, blocking us to receive any update for some time now.

Since i didn't find any workarounds for this, its a big problem for us for a security point of view. Also, it looks like google will not drop this any time soon and more libraries will use this since there is already in stable version, blocking the use of this libraries in any xamarin project.

Relates to: https://github.com/xamarin/xamarin-android/issues/3853

Steps to Reproduce

Just try binding a android library that has databinding enabled in his build.gradle:

android {
    ...
    buildFeatures {
        dataBinding true
    }
}

Did you find any workaround?

no

Relevant log output

No response

jpobst commented 1 year ago

Supporting Java DataBinding is not currently on our roadmap.

It is rather complex to integrate into our build system, as we do not currently invoke gradle during builds. I think what would need to happen is the step that compiles the generated Java callable wrappers would need to be changed to invoke gradle instead of javac. Additionally there would need to be a mechanism to add arbitrary gradle commands to this invocation. I think there are also Java annotations that we would need to add to the JCWs.

We will continue to monitor the need for this (and other enhancements that require adding gradle to the build, potentially AndroidX.Room(?)) for future prioritization.

GalaxiaGuy commented 1 year ago

For reference, here is another thing that would benefit from gradle support:

https://github.com/xamarin/GooglePlayServicesComponents/issues/172

ziomek64 commented 1 month ago

Supporting Java DataBinding is not currently on our roadmap.

It is rather complex to integrate into our build system, as we do not currently invoke gradle during builds. I think what would need to happen is the step that compiles the generated Java callable wrappers would need to be changed to invoke gradle instead of javac. Additionally there would need to be a mechanism to add arbitrary gradle commands to this invocation. I think there are also Java annotations that we would need to add to the JCWs.

We will continue to monitor the need for this (and other enhancements that require adding gradle to the build, potentially AndroidX.Room(?)) for future prioritization.

What are the current options to have UI binded to properties in code in native Android .NET then? And I don't want to explicitly set texts, images through code each time. MVVMCross seems like an overkill for me and completely overwhelming to start using. Bindings are so much easier in MAUI using XAML and INotifyPropertyChanged.