问题
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.
回答1:
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
来源:https://stackoverflow.com/questions/25772847/android-wear-embedding-old-cached-wear-apk-in-the-mobile-release-apk