Search code examples
androidandroid-studiowear-os

Android/WearOS Program Structure


I am new to Android development and wanted some guidance. I am building a Mobile + WearOS app. I have a shared project, which I expect to be for the objects each device will manipulate. I have SQLlite utilities, those should be in a directory of the mobile app under the java directory. Does all that sound right from a structure standpoint? I expect I will have cloud utilities as well which will be a different directory under the mobile app java directory.


Solution

  • I assume your problem is: How to share codes between mobile and wear module.

    You need to create an AndroidLibrary Module through File - New - New Module. After that add it as a dependency to your mobile and wear module. Just in build.gradle (mobile's and wear's) add implementation project(':{your_module_name}') in dependencies section.

    Now you can move all your codes that you want to share to the new lib moudule, then both mobile and wear mudule can ues them.