Android wear not packaging watch app in debug mode - android

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.

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"?

Related

Debug Adobe Air app on Android without erasing app data

I need to debug a new version of an Adobe Air app on Android. This has to be not a "clean install", but an actual update so that all the data is preserved from the previous version. Debugging from Animate CC (formerly Flash Professional) automatically deletes the app and data. Is there a way circumvent that?
Make sure the app version is higher, export apk and manually install the apk on the device without animate cc.
That works for release builds, debug builds im not sure give it a shot

App is crashing while clicking on app icon

I installed the app through android studio and its working fine, but when I create the apk and then I installed the apk, on some devices my app is crashing.
Can someone know how we can see the logs or errors in case when we installed through apk, in can't debug the app bcos its working that time.
here are few details,
build variant: debug,
my apk name: app-debug.apk,
and I am using 2 3rd party libs as an .aar files
If you have installed the apk also you can able to get the logs if you have connected your device with studio. For that you have set the No Filter in Android Monitor.
In the phones, your app is crashing, don't just install the app by apk there. May be some of your 3rd party dependency is not compatible with those versions or phones.
Debug your app in those phone with cable and check error logs. You will get to know the problem

How to run Android Wear signed apk?

I am creating a watch face for android wear. After creating watch face and reading this, I have generated signed apk for android wear.
But android studio is generating two signed apk: one for mobile device and another for wearable.
I want to pack my wearable app inside my mobile app so that watchface appear on companion app as shown on developer's guide.
I installed mobile-release.apk but when I open it it doesn't showing in companion app or anywhere. Can anyone help me how to install it?
Assuming you use android studio:
Your mobile build.gradle file should have the following dependency:
dependencies {
...
wearApp project(':wear')
}
Go to Build > Generate signed apk. In the first window, select mobile as your module.
Now when the build is complete, the wear module will automatically be embedded into the mobile module. The mobile apk is the one you distribute. Wear can be used for testing.

android-wear embedding old (cached) wear apk in the mobile-release apk

I am generating the signed apk using the option Build -> Generate Signed APK
Problem is mobile-release.apk doesn't embed the updated wear apk. I have tried changing text / logic, but it always display the old thing.
I have tried all of the following, any ideas why it keep embedding the old wear apk instead of creating the new one.
File -> Invalidate cache / Restart.
Build -> Clean + Rebuild project
Clear cache of wear app on phone
Settings -> Resync all apps (option on handheld wear app)
manually delete all apks in the build folder of both mobile and wear mobile.
Any hints, or anybody facing similar issue, please reply.
Update 1:
I tested the generated wear-release.apk separately, its the latest, still somehow the embedded apk is old.
I changed my gradle config to manually include newly generated apk,
compile fileTree(dir: 'libs', include: ['*.jar'])
// wearApp project(':wear')
wearApp files('wear-release11.apk') // renamed purposefully to make sure its picking right file.
it indeed give error if wear-release11.apk is missing.. but when the wear-release11.apk is available, it still embed some old cached apk.
Update 2:
I extracted and inspected the contents of generated APK, it indeed has the latest generated apk inside it. But somehow, the phone push cached version. Not sure if its 'android-wear' companion app or the Play Store app causing this bug.
For me uninstalling the android-wear companion app (surprisingly, not just clearing data) solve this issue. But it will cache the apk again after some time.
I have seen a situation a while ago where the wearable app would get stuck and would not update. I think the bug has been resolved, but I wanted to put this answer down for the record just in case it is still happening.
If you are 100% sure your APK is versioned properly, then you can try this procedure which should always fix it up. If this does not fix it, then there is a problem with your APK build process:
Factory reset the watch: Settings ... Reset device
On your phone: Settings ... Apps ... Google Play services
Click on clear cache
Click on manage space
Manage wearable storage ... Clear now
Under total data used by Google Play services ... Clear all data
Reboot the phone
Try to pair the phone with the watch again

Android Wear App not installed

we release our first Wearable Application today but sadly this one isn't get installed automatically as it should.
We double checked the APK and the wearable apk is present but never hits the watch. Manually packaging the APK as suggested here http://android-developers.blogspot.de/2014/07/update-on-android-wear-paid-apps.html doesn't helped either. (We know this should only affect paid apps but just to be sure)
Is anybody else facing this issue? The app works if we install the APKs over adb.
Check your permissions. The Smartphone part needs to have all the permissions the Wear component has.
use the same package id for both apps (wear and mobile)
I spend ages on this. The wearApp gradle rule worked fine for me. But then for the Paid version of the app, following the guide on the blog to manually package the wear app, it wouldn't auto-load on the wearable. After lots of checking, I found that the wearApp gradle rule (on Android Studio 0.8.2), did actually place the wearable APK in the raw folder as per the blog post fix. So seems to be fixed in latest Android Studio (without being told?). And for some reason, manually packaging the APKs didn't work.
So use the wearApp gradle rule.
Also, if you need to reference a different version of the wear APK for different handheld APK versions (for free and pro versions to have applicationId that matches the wearable version), use the productFlavors in the wear gradle config:
productFlavors {
freeapp {
applicationId "com.barkside.appfree"
}
proapp {
applicationId "com.barkside.apppro"
}
}
Then in your Pro version gradle (for example), have the wearApp dependency target a particular configuration:
wearApp project(path: ':wear', configuration: 'proappRelease')
You will also need publishNonDefault true in the android block of the wear gradle.
Had the same problem, what helped me was adding
<uses-feature android:name="android.hardware.type.watch" android:required="false"/>
To the mobiles manifest.
What worked for me was removing product flavors. Sucks that I can't have flavor-specific code now, but Android refuses to package the wear app in release otherwise.
See: Android Wear app not installing through handset
You should check adb logcat on both devices to see what is going on. It will give error messages to indicate what problem might be happening.
Also, when you are testing locally, you should only adb install the phone APK to the phone, and let it install the embedded APK to the wearable device. Then you don't need to go all the way through the play store for testing. Make sure you do release builds, because those are the only ones that do the embedded APK with the wearApp() gradle rule.
I had a problem with installing an app, i think because my watch reset when it was installing. I had to desvinculate the watch, after reinstall everything it works. Maybe help someone
This is going to sound like such a basic and silly answer. But when I did my tests, I forgot that in Android Studios where you click on the play button to run your app, you can change it from mobile to wear. I was only ever installing the mobile app and not the wear app on the wear device.
Hope this helps someone.

Categories

Resources