I use Databinding. Sometimes while I make changes project may be broken. Then I go to Build -> Clean project & Re-Build project. And I get some strange error:
Unable to delete file: {path_to_project}\app\build\intermediates\data_binding_dependency_artifacts\debug\dataBindingMergeDependencyArtifactsDebug\out\androidx.databinding.library.baseAdapters--setter_store.json
Every time I don't know how to fix it, because I get this error on clean or rebuild. Even if I make Invalidate caches / Restart the problem isn't gone.
If I try to delete this file manually I get error that file is using by another process. Then I close project and successfully delete this file. But when I open the project and build it I get the same error described above.
As I can see the problem is about databinding, but I'm not sure because I saw the same problem with other files from other users on StackOverflow. Sometimes problem is gone by itself, but usually it isn't. Maybe the problem occurs because of errors in layout files, but how to find it out if there is no errors in build log.
Has anyone meet that error? Any ideas how to fix that situation without crush whole the project in undefined time range?
Note: The Data Binding Library generates a class named BR in the module package which contains the IDs of the resources used for data binding. In the example above, the library automatically generates the BR. item variable.
Recently Android has announced that with Kotlin 1.4. 20, their Android Kotlin Extensions Gradle plugin will be deprecated and will no longer be shipped in the future Kotlin releases. Android Kotlin Extensions plugin brought with it two very cool features : Synthetics let you replace calls to findViewById with kotlinx.
I was getting the error "Can't resolve symbol ActivityMainBinding" after enabling dataBinding in build. gradle. After much trial and error, I figured out the solution was to exit / restart Android Studio. Works fine now.
BR class is the class which is generated by the Data Binding for storing all the reactive values to handle. Observable class.
I have the same problem, and tried the method mentioned above. I could not find the related class in the error message when I searched in the project directory.
In the end, I suspected that it maybe ~/.gradle
problem, and then recompile after deleting, and finally solved.
mv ~/.gradle ~/.gradle_bak
First follow this 4 steps
gradlew clean
)If not helpful please try following steps
gradlew clean
)If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With