As per a lot of examples, android data bindings are enabled by putting the following snippet in build.gradle file:
android {
....
dataBinding {
enabled = true
}
}
However, I'm working on an android project in AOSP which builds using the make file (Android.mk).
So my question is: How can we add support for data-binding dependencies in android make file?
I found a solution that works for me!
The first hurdle to climb will look something like this:
error: package net.mulliken.pinenotenotebook.databinding does not exist
I found that Android Studio automatically generates these files. It was in
app/build/generated/data_binding_base_class_source_out/debug/out/net/mulliken/pinenotenotebook/databinding
. In order to incorporate this in my build I made a symbolic link from my Android studio workspace todatabinding_src
in my packages folder.After that it still didn't work because it could not find the view binding package. You will probably get an error like this:
error: package androidx.viewbinding does not exist
I found that google has a repo that includes this package and so I cloned it into my AOSP workspace under
frameworks
.I then created a new symbolic link from that path into my package directory so that the compiler could find that class:
At the end of the day my
Android.bp
file looks like this:And my package tree looks like this: