I have developed an application for SmartWatch with version of Wear OS 1.5 and up. At the time of distributing the application I have included it together with the main application in the same apk.
I have compiled a release version and installed it, when synchronizing the applications with the SmartWatch, through the debug console I get the following error message.
05-03 18:06:55.637 665-1884/? I/PkgMgrInstallUtil: Sending install intent to PackageInstaller Intent { act=android.intent.action.INSTALL_PACKAGE dat=content://com.google.android.clockwork.home.provider/host/com.sergio.application/wearable/com.sergio.application/apk typ=vnd.android.cursor.item/wearable_apk cmp=com.google.android.packageinstaller/com.android.packageinstaller.wear.WearPackageInstallerService (has extras) } for com.sergio.application
05-03 18:06:56.269 1701-1890/? I/WearPkgInstallerService: Sent installation request for es.usal.bisite.ebikemotion
05-03 18:06:56.281 1722-1732/? D/DefContainer: Copying /data/user/0/com.google.android.packageinstaller/files/tmp/com.sergio.application.apk to base.apk
05-03 18:06:56.528 1701-1743/? E/WearPkgInstallerService: Package install failed com.sergio.application, returnCode -103
05-03 18:06:56.528 1701-1743/? I/WearablePkgInstaller: Sending removeFromPermStore to ShowPermsService Intent { act=android.intent.action.UNINSTALL_PACKAGE cmp=com.google.android.wearable.app/com.google.android.clockwork.packagemanager.ShowPermsService (has extras) } for com.sergio.application
Indicating that the application could not be installed, without giving details of the problem and only indicates the error code -103.
I have taken into account the basic considerations for the development of applications wear.
Both the main application and the SmartWatch have the same application id..
The permissions required in the SmartWatch application are also explicitly configured in the main application.
etc..
The application can be implemented correctly in "standalone" mode, directly from Android Studio.
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
//apply from: 'https://raw.githubusercontent.com/passsy/gradle-GitVersioner/master/git-versioner.gradle'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "com.sergio.application"
minSdkVersion 23
targetSdkVersion 27
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "com.android.support:support-v4:${rootProject.support_library_version}"
implementation "com.android.support:animated-vector-drawable:${rootProject.support_library_version}"
implementation "com.android.support:appcompat-v7:${rootProject.support_library_version}"
implementation "com.android.support:recyclerview-v7:${rootProject.support_library_version}"
implementation "com.android.support:percent:${rootProject.support_library_version}"
implementation "com.google.android.gms:play-services-wearable:${rootProject.play_services_version}"
implementation "com.google.android.gms:play-services-maps:${rootProject.play_services_version}"
implementation 'com.google.android.support:wearable:2.2.0'
compileOnly 'com.google.android.wearable:wearable:2.2.0'
implementation 'com.patloew.rxwear:rxwear:1.3.0'
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
//GLIDE
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'jp.wasabeef:glide-transformations:2.0.1'
//ButterKnife
implementation "com.jakewharton:butterknife:${rootProject.butterknife}"
annotationProcessor "com.jakewharton:butterknife-compiler:${rootProject.butterknife}"
implementation "io.reactivex:rxjava:${rootProject.rx_java}"
implementation "io.reactivex:rxandroid:${rootProject.rx_android}"
//TIMBER
implementation "com.jakewharton.timber:timber:${rootProject.timber}"
implementation('com.crashlytics.sdk.android:answers:1.3.12@aar') {
transitive = true;
}
implementation('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
transitive = true;
}
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
}
Versions used:
support_library_version = "27.1.1"
constraint_layout_version = '1.1.0'
play_services_version = "15.0.0"
Next I show the manifest file of the application.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sergio.application">
<uses-feature android:name="android.hardware.type.watch" android:required="true"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".ApplicationWear"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<uses-library
android:name="com.google.android.wearable" android:required="false" />
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="api_key"/>
<meta-data
android:name="io.fabric.ApiKey"
android:value="api_key" />
<activity android:name=".SplashScreenActivity" android:theme="@android:style/Theme.DeviceDefault.Light">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.DeviceDefault.Light"/>
<activity android:name=".MapActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.DeviceDefault.Light"/>
<service android:name=".DisconnectListenerService"/>
</application>
</manifest>
Can someone help me solve this problem? . Thank you.
Everything is due to a confusion, I had understood that when generating a "release" compilation for the app module the configuration to make the apk signature (keystore, alias, password) was propagated to the module wear. When generating the apk from Android Studio I have no problem, error 103 occurs to me when generating the apk from CLI with ./gradlew assembleRelease
The solution is therefore very simple
Include the following configuration in the gradle of the module wear:
signingConfigs {
release {
storeFile file("./keystore_secret")
storePassword "myPassword"
keyAlias "MyAlias"
keyPassword "myPassword"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
I hope it can be useful to someone too.