Reputation: 1823
Gradle wrapper version: 2.5
Gradle android plugin: compile 'com.android.tools.build:gradle:1.2.3'
Android Studio: Version 1.2.2
Mobile dependencies:
wearApp project(':wear')
compile 'com.google.android.gms:play-services-base:7.5.0@aar'
compile 'com.google.android.gms:play-services-wearable:7.5.0@aar'
compile "com.android.support:support-v4:22.2.1"
Wear dependencies:
compile 'com.google.android.support:wearable:1.2.0'
compile 'com.google.android.gms:play-services-wearable:7.5.0'
By running assembleDebug, the mobile app gets built and packaged and then the wear app is built and packaged independently. This way, the wear apk does not end up inside the res/raw folder of the mobile app, the manifest is not updated etc.
But, if I run assembleRelease, the wear app is built first and correctly packaged inside the mobile app and installed on the watch.
I though that maybe signing would be the issue. I gave the debug build the same signing config as release (same certificate, keystore etc) but still same behavior.
This happens either using Android Studio or packaging from the command line.
Needless to say, this is very inconvenient since I can't debug the app on either device.
Has anyone ever experienced this behavior? Has anything changed in the gradle plugin that we have to enable to package wear apps in debug mode?
UPDATE: I don't know if my memory is failing me, but I do recall being able to package de app with assembleDebug, deploy to the phone (and consequently to the watch) and being able to attach the debugger on the watch.
I might be mistaken though. What I ended up doing was deploying the apps independently on both devices (through Android Studio) and going from there. It might be that I always did that in the past and the way the documentation is written lead me to believe otherwise. I will still leave this question here for other people.
Upvotes: 2
Views: 647
Reputation: 19084
If I recall correctly, the packaging of wear app inside the phone app is only done for release builds, so that is by design. In reality, when I am developing an app or debugging one, it is a LOT more convenient for me to just use adb to push the wear app; I don't have to constantly increment the version (otherwise the wear app will not be updated), nor I need to build the phone app each time. Is there a reason you cannot do that? Also, is there a reason you say ".. I can't debug the app on either device"?
Upvotes: 3