失败 [INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE]
Failure [INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE]
我在CMD中输入了下面的命令,命令下面返回了错误。
命令:
phonegap run android --verbose --stacktrace
错误:
ERROR: Failed to launch application on device:
ERROR: Failed to install apk to device: pkg: /data/local/tmp/MainActivity-debug.apk
Failure [INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE]
解法:
我通过从我的设备上卸载我的应用程序设法摆脱了错误。
原因:
可能导致错误的原因是我将 Android SDK 更新为 SDK Manager。
这里的问题是,您尝试安装的 APK 版本低于您设备上已有的版本。
卸载肯定会为您解决该问题。
ADB 允许更大的灵活性 adb install -r -d <apk path>
,但我不确定 Phonegap 是否具有该功能。
adb install [-lrtsdg] <file>
- push this package file to the device and install it
(-l: forward lock application)
(-r: replace existing application)
(-t: allow test packages)
(-s: install application on sdcard)
(-d: allow version code downgrade)
(-g: grant all runtime permissions)
更新:
原来这不是降级App版本的正确错误信息。事实上,它是完全不同的东西。我found this link准确说明情况:
tl;dr You can't fool the new Android 6 permissions model by first
publishing an APK with targetSdk 23 which will grant all permissions
runtime and then publishing a new version with targetSdk 22 or less.
You'll get an INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE error.
I was working on an app with targetSdk 23 (Android 6 Marshmallow) when
it hit me that it possibly could be a security issue with the new
Android permission model. Android 6 devices approves all permission on
install time and then the user has to approve them whenever the app
asks for the permission. What if the user installed the app - auto
granting all permissions - and then it didn't ask for using them, and
then afterwards the app was updated with the same permissions, but
with a lower targetSdk?
I spent a couple minutes creating an app that targeted SDK level 23
and added a fine location permission (ACCESS_FINE_LOCATION). Then I
installed and ran the app. The app didn't ask for permission to access
the location manager. Then I set the SDK level to 22 and tried to
install the app. Luckily it wasn't able to install. I got an error
saying Failure [INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE].
我在 VS2015 中使用 TACO 并使用特定模拟器配置文件调试 Android 时遇到此错误:VS Emulator 10.1" Marshmallow (6.0.0) XHDPI Tablet。我正在处理的项目安装为该特定配置文件上的应用程序,因为我一直在使用它进行调试。我通过卸载并重新安装该特定配置文件解决了这个问题:工具 -> Visual Studio Android 的模拟器 -> 卸载配置文件。重新安装的配置文件没有不再包含我的应用程序并且错误消失了。我猜这相当于从远程设备卸载应用程序的 VS 模拟器。
我在CMD中输入了下面的命令,命令下面返回了错误。
命令:
phonegap run android --verbose --stacktrace
错误:
ERROR: Failed to launch application on device:
ERROR: Failed to install apk to device: pkg: /data/local/tmp/MainActivity-debug.apk
Failure [INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE]
解法:
我通过从我的设备上卸载我的应用程序设法摆脱了错误。
原因:
可能导致错误的原因是我将 Android SDK 更新为 SDK Manager。
这里的问题是,您尝试安装的 APK 版本低于您设备上已有的版本。
卸载肯定会为您解决该问题。
ADB 允许更大的灵活性 adb install -r -d <apk path>
,但我不确定 Phonegap 是否具有该功能。
adb install [-lrtsdg] <file>
- push this package file to the device and install it
(-l: forward lock application)
(-r: replace existing application)
(-t: allow test packages)
(-s: install application on sdcard)
(-d: allow version code downgrade)
(-g: grant all runtime permissions)
更新:
原来这不是降级App版本的正确错误信息。事实上,它是完全不同的东西。我found this link准确说明情况:
tl;dr You can't fool the new Android 6 permissions model by first publishing an APK with targetSdk 23 which will grant all permissions runtime and then publishing a new version with targetSdk 22 or less. You'll get an INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE error.
I was working on an app with targetSdk 23 (Android 6 Marshmallow) when it hit me that it possibly could be a security issue with the new Android permission model. Android 6 devices approves all permission on install time and then the user has to approve them whenever the app asks for the permission. What if the user installed the app - auto granting all permissions - and then it didn't ask for using them, and then afterwards the app was updated with the same permissions, but with a lower targetSdk?
I spent a couple minutes creating an app that targeted SDK level 23 and added a fine location permission (ACCESS_FINE_LOCATION). Then I installed and ran the app. The app didn't ask for permission to access the location manager. Then I set the SDK level to 22 and tried to install the app. Luckily it wasn't able to install. I got an error saying Failure [INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE].
我在 VS2015 中使用 TACO 并使用特定模拟器配置文件调试 Android 时遇到此错误:VS Emulator 10.1" Marshmallow (6.0.0) XHDPI Tablet。我正在处理的项目安装为该特定配置文件上的应用程序,因为我一直在使用它进行调试。我通过卸载并重新安装该特定配置文件解决了这个问题:工具 -> Visual Studio Android 的模拟器 -> 卸载配置文件。重新安装的配置文件没有不再包含我的应用程序并且错误消失了。我猜这相当于从远程设备卸载应用程序的 VS 模拟器。