Package with Android Studio
To properly package a wearable app in Android Studio:
- Include all the permissions declared in the manifest file of the wearable app module in the manifest file of the handheld app module. For example, if you specify the
VIBRATE
permission for the wearable app, you must also add that permission to the handheld app. - Ensure that both the wearable and handheld app modules have the same package name and version number.
- Declare a Gradle dependency in the handheld app's
build.gradle
file that points to the wearable app module:dependencies { compile 'com.google.android.gms:play-services:5.0.+@aar' compile 'com.android.support:support-v4:20.0.+'' wearApp project(':wearable') }
- Click Build > Generate Signed APK... and follow the on-screen instructions to specify your release keystore and sign your app. Android Studio exports the signed handheld app with the wearable app embedded in it automatically into your project's root folder.
上面是官方的guide,
如果仅仅是做一个测试,android studio 已经为我们做了东西。
我们要做的仅仅是
1:在创建工程的时候勾选上wear,
2:删除掉gradle 里面和google play service 相关的东西,
3:然后执行上面第四步就可以了。