Status Update
Comments
il...@google.com <il...@google.com>
il...@google.com <il...@google.com> #2
this would be nice but given Compose and all other priorities, we are not planning to make any big investments in data binding (support KSP is a very big task).
il...@google.com <il...@google.com>
lo...@gmail.com <lo...@gmail.com> #3
Makes sense. And is there any way to trigger data binding without kapt plugin, assuming there are no custom binding adapters in given module?
ja...@gmail.com <ja...@gmail.com> #4
unfortunately no. data binding still needs to be able to read your code and annotation processing is the only API that allows us to do it :(
b9...@gmail.com <b9...@gmail.com> #5
It's a very disappointing decision for many projects who heavily depend on data binding, which will never be able to get rid of all bindings code and especially rewrite all UI to Compose.
It means that bindings are essentially deprecated
ka...@gmail.com <ka...@gmail.com> #6
It does not mean data binding is deprecated unless KAPT is deprecated (if that happens, we would need to support KSP).Unfortunately, moving data binding to KSP is a large order so it makes more sense to keep focusing on KAPT than rewrite data binding.
We might re-consider this in the future based on KSP becoming stable, Compose adoption and KAPT stability but it is very unlikely to happen.
yc...@gmail.com <yc...@gmail.com> #8
Unfortunately this is still a NO for 2022 planning due to reasons mentioned in #2.
il...@google.com <il...@google.com> #9
kapt seems no longer adding new feature
kapt is in maintenance mode. We are keeping it up-to-date with recent Kotlin and Java releases but have no plans to implement new features. Please use the Kotlin Symbol Processing API (KSP) for annotation processing. See the list of libraries supported by KSP.
So this mean databinding will also deprecated or will be support KSP?
[Deleted User] <[Deleted User]> #10
We don't plan to support KSP nor recommend data binding usage at this stage since compose is our recommended UI solution.
kk...@google.com <kk...@google.com> #11
We don't plan to support KSP nor recommend data binding usage at this stage since compose is our recommended UI solution.
I have been waited this answer in several years.
Because it is an important basis to convince co-workers and for determining the technology stack of an app.
[Deleted User] <[Deleted User]> #12
Databinding is in maintenance mode as well.
We don't plan to support KSP nor recommend data binding usage at this stage since compose is our recommended UI solution.
A bit of a tangent here, but what about ViewBinding? Will that one stay going strong or will it fade along with DataBinding?
an...@gmail.com <an...@gmail.com> #13
So if you are using Views, ViewBinding will keep working.
It is the same for Data Binding as well though. The main difference is that if KAPT stops working, DataBinding will stop working whereas ViewBinding will keep working. Hopefully, any such situation will be far enough that no-one will care and everyone will be using Compose :)
al...@gmail.com <al...@gmail.com> #16
#14 Kapt will be supported on K2, there are no plans to stop supporting it in Kotlin
lb...@gmail.com <lb...@gmail.com> #17
al...@gmail.com <al...@gmail.com> #18
3g...@gmail.com <3g...@gmail.com> #20
file sdcard encrypt....
[Deleted User] <[Deleted User]> #21
Common
Description
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation "android.arch.lifecycle:runtime:1.1.0"
implementation "android.arch.lifecycle:extensions:1.1.0"
implementation "android.arch.lifecycle:common-java8:1.1.0"
Version used: 27.1.0
Theme used: N/A
Devices/Android versions reproduced on: Emulator 24
- Relevant code to trigger the issue.
Make an Activity that contains a Fragment.
Make the Activity use a ViewModel, and make the Fragment also use a ViewModel.
Start the Activity and press back.
The Activity's ViewModel's onCleared method is called.
With AppCompat 27.0.2, the Fragment's ViewModel's onCleared method is called (as it should)
With AppCompat 27.1.0, the Fragment's ViewModel's onCleared method is not called (incorrect).
See the attached project that shows the issue.
With 27.0.2, the logs read:
---------------------------
org.jraf.android.viewmodelproblem.MainActivity: onCreate
org.jraf.android.viewmodelproblem.MainActivityViewModel: constructor
org.jraf.android.viewmodelproblem.MainFragment: onCreate
org.jraf.android.viewmodelproblem.MainFragmentViewModel: constructor
[back is pressed]
org.jraf.android.viewmodelproblem.MainActivity: onDestroy
org.jraf.android.viewmodelproblem.MainActivityViewModel: onCleared
org.jraf.android.viewmodelproblem.MainFragmentViewModel: onCleared
org.jraf.android.viewmodelproblem.MainFragment: onDestroy
With 27.1.0, the logs read:
---------------------------
org.jraf.android.viewmodelproblem.MainActivity: onCreate
org.jraf.android.viewmodelproblem.MainActivityViewModel: constructor
org.jraf.android.viewmodelproblem.MainFragment: onCreate
org.jraf.android.viewmodelproblem.MainFragmentViewModel: constructor
[back is pressed]
org.jraf.android.viewmodelproblem.MainActivity: onDestroy
org.jraf.android.viewmodelproblem.MainActivityViewModel: onCleared
org.jraf.android.viewmodelproblem.MainFragment: onDestroy
This seems to happen because of line 1645 of Fragment, this test:
if (mViewModelStore != null && !mHost.mFragmentManager.isStateSaved()) {
is always false because mHost.mFragmentManager.isStateSaved() is true.