If you use the Google official recommended integrated development IDE Android Studio development, will automatically generate two projects, one on the phone side, one is the watch side.
But if you use the Eclipse environment, if you want to hit your watch apk into your phone apk, you need to be aware of the following points:
1. The permission in the wearable app should also be added in the mobile app;
2, ensure that the wearable app and mobile app have the same package name and version number;
3. Put the signed wearable app in the Res/raw directory of the mobile app project, assuming the wearable app uses the name wearable_app.apk;
4. Create a Res/xml/wearable_app_desc.xml file that includes the version and path information of the wearable app
<wearableapp package= "Wearable.app.package.name" > <versionCode>1</versionCode> <versionname& Gt;1.0</versionname> <rawPathResId>wearable_app</rawPathResId></wearableApp>
where Package,versionvode and versionname need to be the same value in the androidmanifest.xml of the wearable app.
Respathresid is the name of wearable apk, for example: wearable_app.apk respathresid for Wearable_app.
5. Add <meta-data> to indicate Wearable_app_desc.xml file in the <application> tag in the mobile app's Androidmanifest file
<meta-data android:name= "Com.google.android.wearable.beta.app" android:resource= "@xml/wearable_app_desc"/>
6. Build Signature mobile App
7. Turn off asset compression
Many compilation tools compress files in the Res/raw directory. Since the APK package has been compressed into the zipped format, many of the compilation tools will be compressed again, causing the wearable app installer to not be properly left alone in the wearable app, prompting the following error:
Packageupdateservice: "This file cannot was opened as a file descriptor, it is probably compressed."
Android Studio does not compress the wearable apk again by default, but you need to be aware of this with other compilation tools.
Manually playing Android Wear APK package