Reputation: 8292
I can't package my Android Wear app, when it's installed on phone, wear version are not on watch.
There is my gradle files (wear) :
buildscript {
dependencies {
}
}
apply plugin: 'com.android.application'
def versionMajor = Integer.parseInt(APP_VERSION_MAJOR)
def versionMinor = Integer.parseInt(APP_VERSION_MINOR)
def versionPatch = Integer.parseInt(APP_VERSION_PATCH)
def versionBuild = Integer.parseInt(APP_VERSION_BUILD)
android {
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
defaultConfig {
applicationId project.PACKAGE_NAME
minSdkVersion Integer.parseInt(ANDROID_BUILD_MIN_SDK_VERSION_WEAR)
targetSdkVersion Integer.parseInt(ANDROID_BUILD_TARGET_SDK_VERSION)
versionCode versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionBuild
versionName "${versionMajor}.${versionMinor}.${versionPatch}.${versionBuild}"
manifestPlaceholders = [watchfaceName: project.WATCHFACE_NAME, appName: project.APP_NAME]
}
signingConfigs {
release {
storeFile file("/Users/jimmy/Developer/keystore")
keyAlias 'name'
storePassword 'pw'
keyPassword 'pw'
}
}
buildTypes {
release {
runProguard false
signingConfig signingConfigs.release
}
}
}
dependencies {
compile project(':submodules:watchface-gears:library')
compile project(':commonlibrary')
compile 'com.google.android.support:wearable:1.+'
compile 'com.google.android.gms:play-services-wearable:6.+'
compile 'com.jakewharton:butterknife:5.1.+'
}
and mobile :
apply plugin: 'com.android.application'
def versionMajor = Integer.parseInt(APP_VERSION_MAJOR)
def versionMinor = Integer.parseInt(APP_VERSION_MINOR)
def versionPatch = Integer.parseInt(APP_VERSION_PATCH)
def versionBuild = Integer.parseInt(APP_VERSION_BUILD)
android {
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
defaultConfig {
applicationId project.PACKAGE_NAME
minSdkVersion Integer.parseInt(ANDROID_BUILD_MIN_SDK_VERSION)
targetSdkVersion Integer.parseInt(ANDROID_BUILD_TARGET_SDK_VERSION)
versionCode versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionBuild
versionName "${versionMajor}.${versionMinor}.${versionPatch}.${versionBuild}"
manifestPlaceholders = [watchfaceName: project.WATCHFACE_NAME, appName: project.APP_NAME]
}
signingConfigs {
release {
storeFile file("/Users/jimmy/Developer/keystore")
keyAlias 'name'
storePassword 'pw'
keyPassword 'pw'
}
}
buildTypes {
release {
runProguard false
signingConfig signingConfigs.release
}
}
}
dependencies {
compile project(':commonlibrary')
compile "com.android.support:appcompat-v7:21.+"
compile fileTree(dir: 'libs', include: ['*.jar'])
wearApp project(':wear')
}
And also my Manifest (wear):
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.jaumard.skullface">
<uses-feature android:name="android.hardware.type.watch"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="com.google.android.permission.PROVIDE_BACKGROUND"/>
<application
android:label="${appName}"
android:name="com.jaumard.skullface.WatchfaceApp">
<activity android:name="android.support.wearable.activity.ConfirmationActivity"
android:theme="@style/ConfirmTheme"/>
<activity
android:theme="@android:style/Theme.DeviceDefault.NoActionBar"
android:name="com.jaumard.skullface.activity.WatchfaceActivity"
android:label="${watchfaceName}"
android:taskAffinity=""
android:allowEmbedded="true">
<meta-data android:name="com.google.android.clockwork.home.preview" android:resource="@drawable/preview"/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="com.google.android.clockwork.home.category.HOME_BACKGROUND"/>
</intent-filter>
</activity>
<activity
android:theme="@android:style/Theme.DeviceDefault.NoActionBar"
android:name="com.jaumard.skullface.activity.DrawerActivity"
android:label="${watchfaceName}"
android:excludeFromRecents="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:theme="@android:style/Theme.DeviceDefault.NoActionBar"
android:name="com.jaumard.skullface.activity.DreamSettingsActivity"
android:label="${watchfaceName}">
</activity>
<service
android:name=".services.LauncherService"
android:enabled="true">
</service>
<service
android:name="com.jaumard.skullface.services.DataService">
<intent-filter>
<action android:name="com.google.android.gms.wearable.BIND_LISTENER"/>
</intent-filter>
</service>
<service
android:name="com.jaumard.skullface.services.DreamerService"
android:exported="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.service.dreams.DreamService" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<!-- Point to additional information for this dream (optional) -->
<meta-data
android:name="android.service.dream"
android:resource="@xml/dream" />
</service>
<receiver android:name="com.jaumard.skullface.helpers.PackageReceiver"
android:exported="true"
android:enabled="true">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REMOVED"/>
<action android:name="android.intent.action.PACKAGE_ADDED"/>
<action android:name="android.intent.action.PACKAGE_REPLACED"/>
<data android:scheme="package"/>
</intent-filter>
</receiver>
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
</application>
</manifest>
And mobile :
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.jaumard.skullface">
<uses-feature android:name="android.hardware.type.watch" android:required="false"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="com.google.android.permission.PROVIDE_BACKGROUND"/>
<application
android:allowBackup="true"
android:icon="@drawable/preview"
android:theme="@style/AppTheme"
android:label="${appName}">
<activity android:name="com.jaumard.skullface.activities.MainActivity"
android:label="${appName}"
android:icon="@drawable/preview"
>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name="com.jaumard.skullface.activities.DrawerActivity"
android:label="@string/home_drawer">
</activity>
<activity android:name="com.jaumard.skullface.activities.ClockActivity"
android:label="@string/home_clock">
</activity>
<receiver android:name="com.jaumard.skullface.DataListener" android:enabled="true">
<intent-filter>
<action android:name="android.intent.action.ACTION_POWER_CONNECTED"/>
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED"/>
<action android:name="jaumard.ACTION_BATTERY_CHANGED"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
<service
android:name="com.jaumard.skullface.services.DataService" android:exported="false"
android:enabled="true">
</service>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>
</application>
</manifest>
I don't understand why wear app is not installed...
EDIT : I can make it work by manually sign/package wear app or by modifing gradle file like this :
wearApp project(':wear')
wearApp files('../wear/build/outputs/apk/wear_release.apk')
Upvotes: 1
Views: 1037
Reputation: 303
If you are building with Android Studio using gradle, just make the wearable app as a module in your phone project. Then you have to make sure you have done the following configurations:
The phone manifest and the wearable manifest should declare exactly the same permissions.
Ensure that both the wearable and handheld app modules have the same package name and version number.
When signing with the debug key, your wearable app will not be installed automatically by installing the phone app. You should manually install the wearable app on the wearable device via bluetooth debug.
Upvotes: 0
Reputation: 1692
I had the same problem but solve it with checking permissions. Could you check that the wearable and mobile apps has exactly the same permissions ?
Upvotes: 0
Reputation: 285
Do you use release key for signing? You have to use it, debug keys don't work here.
Check your final apk file. If you properly included wear project to mobile, you should have android_wear_micro_apk.apk in your res/raw folder
Upvotes: 1