WearPkgInstallerService:包安装失败。返回码-103
WearPkgInstallerService: Package install failed. returnCode -103
我已经为 SmartWatch 开发了 Wear OS 1.5 及更高版本的应用程序。在分发应用程序时,我已将它与主应用程序一起包含在同一个 apk 中。
我已经编译了一个发布版本并安装了它,当应用程序与智能手表同步时,通过调试控制台我得到以下错误信息。
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
提示无法安装应用程序,没有详细说明问题,只提示错误代码-103.
我考虑到了开发应用磨损的基本考虑。
主应用和智能手表一样
应用程序 ID..
智能手表应用中需要的权限也是
在主应用程序中明确配置。
等..
应用程序可以在“standalone”模式下正确实现,直接来自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'
}
使用的版本:
support_library_version = "27.1.1"
constraint_layout_version = '1.1.0'
play_services_version = "15.0.0"
接下来我展示应用程序的清单文件。
<?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>
有人可以帮我解决这个问题吗? .谢谢。
一切都是由于混乱,我了解到在为应用程序模块生成“release”编译时,进行 apk 签名的配置(密钥库、别名、密码) 传播到模块磨损。当从 Android Studio 生成 apk 时我没有问题,当我使用 ./gradlew assembleRelease
从 CLI 生成 apk 时出现错误 103
因此解决方案非常简单
在模块wear的gradle中加入如下配置:
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
}
}
我希望它也能对某人有用。
我已经为 SmartWatch 开发了 Wear OS 1.5 及更高版本的应用程序。在分发应用程序时,我已将它与主应用程序一起包含在同一个 apk 中。
我已经编译了一个发布版本并安装了它,当应用程序与智能手表同步时,通过调试控制台我得到以下错误信息。
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
提示无法安装应用程序,没有详细说明问题,只提示错误代码-103.
我考虑到了开发应用磨损的基本考虑。
主应用和智能手表一样 应用程序 ID..
智能手表应用中需要的权限也是 在主应用程序中明确配置。
等..
应用程序可以在“standalone”模式下正确实现,直接来自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'
}
使用的版本:
support_library_version = "27.1.1"
constraint_layout_version = '1.1.0'
play_services_version = "15.0.0"
接下来我展示应用程序的清单文件。
<?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>
有人可以帮我解决这个问题吗? .谢谢。
一切都是由于混乱,我了解到在为应用程序模块生成“release”编译时,进行 apk 签名的配置(密钥库、别名、密码) 传播到模块磨损。当从 Android Studio 生成 apk 时我没有问题,当我使用 ./gradlew assembleRelease
因此解决方案非常简单
在模块wear的gradle中加入如下配置:
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
}
}
我希望它也能对某人有用。