Some Android multi-module architecture examples show that domain layer depends on data. Others are vice versa.
Android Developers site says:
The domain layer is an optional layer that sits between the UI layer and the data layer.
Also it shows picture where domain depends on data:
Meanwhile another article on proandroiddev.com says:
1.
Domain Layer is the most INNER part of the onion (no dependencies with other layers) and it contains Entities, Use cases & Repository Interfaces. Use cases combine data from 1 or multiple Repository Interfaces.
One of the most common mistakes is to have your app driven by your data layer/specific data system.
Domain Layer does NOT depend on Data Layer.
So could you please describe which approach is better for Android multi-module and why?
If taken into consideration both of the Docs are correct with the proper context of what you want to achieve.
You want to implement a solution just & just for Android, the Android developer's doc is more suitable for it. You want to create a project which can target for Multiple platform (Android, iOS, desktop), the ProAndroidDev's architecture is more suitable.
Also, while reading their doc, I want you to keep their end goal and context in mind.
In Android developer's doc, the Data Layer consists of Entity & Repository classes. These classes are required in Usecase classes & hence there is dependency of Domain layer on data layer. In this architecture, the assumption is that you are building the App only for Android, so there is no need of creating an abstraction for Repository classes, since it would create more complexity.
In ProAndroid dev's doc, the assumption is that maybe you are building the App for Android for now and later you may introduce other platforms or you are targeting for multiple platforms now only. In this case, the Repository class abstraction become a lot more important, since by adding it in early stage, you may reduce your future bugs/refactor. In this doc, to achieve above purpose, instead of Data layer, the domain layer now contains the Usecase, Entity & Repository interface classes & Data Layer contains the Repository Impl classes. As a result, the domain layer does not need any dependency & hence it should not have any dependency on other layer.
I think in ProAndroid dev's blog, if they had referred the layer containing Repositories as Repository Layer instead of Data Layer, then this confusion could have been avoided. In Android's blog, they refer it to Data layer since it contains the actual data/POJO classes & Repository classes (Classes responsible for managing this data).