I am successfully building an Android Wear watch face and connected app on the mobile device. The problem is that I have several resource and class files that are referenced in both the mobile
and wear
modules. The skeleton app I built this from also created a (non-building) DigitalWatch
module and I'm guessing I could move these common files in there and then reference them from my Gradle build files. I've reviewed some of the ideas on Stackoverflow, but the comments suggest they don't work.
Here's my project structure. Common files include res/strings.xml, a utility class, and the google json files.
I've successfully moved both common java utility classes and strings/drawables into a seperate module called "Common" and reference it in both the mobile and wear gradle files as follows
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':common')
...
}
You will have to add imports to reference your java classes in the common module and resources work if you add xmlns:app="http://schemas.android.com/apk/res-auto"
to the top element in your layouts.
The google-services.json
I have not been able to move as there is a fixed relative reference to this within the Google libraries.
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