如何为 Google Play 发布打包 WatchFace only App
How to package a WatchFace only App for Google Play publishing
到目前为止
我正在开发 android 佩戴的表盘应用程序。
我创建了 2 个模块:
- Wear - 在开发中运行良好的表盘
- Mobile - 没有 activity 的空模块,如评论
所建议
我已经按照 packaging wear apps for the playstore
中的描述将 wear 模块作为依赖项添加到手机中
该应用程序在 Play 商店中处于 alpha 阶段。我已经上传手机-release.apk.
该应用程序在我的手机上安装正常,但 Wear 模块,WatchFace 无法安装在我的穿戴设备上。 这是我的问题。
我做错了什么?
这是我的清单和 Gradle 配置
手机清单
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dimitrioskanellopoulos.athletica">
<uses-permission android:name="android.permission.BODY_SENSORS"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:supportsRtl="true"
android:theme="@style/AppTheme">
</application>
佩戴清单
<service
android:name="com.dimitrioskanellopoulos.athletica.WatchFaceService"
android:label="@string/app_name"
android:permission="android.permission.BIND_WALLPAPER">
<meta-data
android:name="android.service.wallpaper"
android:resource="@xml/watch_face" />
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="@drawable/preview_rectangular" />
<meta-data
android:name="com.google.android.wearable.watchface.preview_circular"
android:resource="@drawable/preview_circular" />
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
</intent-filter>
</service>
Build.gradle 项目
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Build.gradle 移动模块
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.dimitrioskanellopoulos.athletica"
minSdkVersion 22
targetSdkVersion 23
versionCode 4
versionName "1.0.2"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
zipAlignEnabled true
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
wearApp project(':wear')
}
Build.gradle 磨损模块
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.dimitrioskanellopoulos.athletica"
minSdkVersion 22
targetSdkVersion 23
versionCode 4
versionName "1.0.2"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
zipAlignEnabled true
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-annotations:23.3.0'
compile 'com.google.android.support:wearable:1.4.0'
compile 'com.android.support:support-v4:23.3.0'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.google.android.gms:play-services-wearable:8.4.0'
compile 'com.luckycatlabs:SunriseSunsetCalculator:1.2'
compile 'org.apache.commons:commons-lang3:3.4'
}
如有任何帮助,我们将不胜感激!
好吧,一段时间后它就安装好了。拍了好几个uninstalls/installs。
更新后的清单是评论的结果,对此表示感谢。
到目前为止
我正在开发 android 佩戴的表盘应用程序。
我创建了 2 个模块:
- Wear - 在开发中运行良好的表盘
- Mobile - 没有 activity 的空模块,如评论 所建议
我已经按照 packaging wear apps for the playstore
中的描述将 wear 模块作为依赖项添加到手机中该应用程序在 Play 商店中处于 alpha 阶段。我已经上传手机-release.apk.
该应用程序在我的手机上安装正常,但 Wear 模块,WatchFace 无法安装在我的穿戴设备上。 这是我的问题。
我做错了什么?
这是我的清单和 Gradle 配置
手机清单
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dimitrioskanellopoulos.athletica">
<uses-permission android:name="android.permission.BODY_SENSORS"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:supportsRtl="true"
android:theme="@style/AppTheme">
</application>
佩戴清单
<service
android:name="com.dimitrioskanellopoulos.athletica.WatchFaceService"
android:label="@string/app_name"
android:permission="android.permission.BIND_WALLPAPER">
<meta-data
android:name="android.service.wallpaper"
android:resource="@xml/watch_face" />
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="@drawable/preview_rectangular" />
<meta-data
android:name="com.google.android.wearable.watchface.preview_circular"
android:resource="@drawable/preview_circular" />
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
</intent-filter>
</service>
Build.gradle 项目
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Build.gradle 移动模块
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.dimitrioskanellopoulos.athletica"
minSdkVersion 22
targetSdkVersion 23
versionCode 4
versionName "1.0.2"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
zipAlignEnabled true
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
wearApp project(':wear')
}
Build.gradle 磨损模块
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.dimitrioskanellopoulos.athletica"
minSdkVersion 22
targetSdkVersion 23
versionCode 4
versionName "1.0.2"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
zipAlignEnabled true
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-annotations:23.3.0'
compile 'com.google.android.support:wearable:1.4.0'
compile 'com.android.support:support-v4:23.3.0'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.google.android.gms:play-services-wearable:8.4.0'
compile 'com.luckycatlabs:SunriseSunsetCalculator:1.2'
compile 'org.apache.commons:commons-lang3:3.4'
}
如有任何帮助,我们将不胜感激!
好吧,一段时间后它就安装好了。拍了好几个uninstalls/installs。
更新后的清单是评论的结果,对此表示感谢。