2016-01-14 15 views
12

以下のコマンドをCMDに入力しましたが、このコマンドはコマンドの下にエラーを返しました。失敗[INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE]

コマンド:

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]

+0

非常に便利なクエリです。私はthです。 –

答えて

30

問題は、お使いの端末に既に搭載されているバージョンよりも少ないバージョンの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) 

更新:

それはそれはアプリのバージョンをダウングレードするための正しいエラーメッセージではありませんでしたが判明しました。事実、それは完全に別のものです。

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].

+0

** - r **はどこにありますか?私は[developer.android.comのアンドロイドデバッグブリッジのドキュメント](http://developer.android.com/tools/help/adb.html)でそれを見つけることはできません。あなたはまた、 'バージョン'であなたが意味することを言うことができますか?それは少し曖昧です。 – SPottuit

+0

オプションの意味を反映するように質問を更新しました。バージョンではあなたのAppバージョンを意味します。 Appバージョン3がインストールされていて、Appバージョン2をインストールしようとすると、HTE劣化フラグが設定されていないため、許可されません。 – Knossos

+0

私はあなたの理論をテストしました。私はアプリケーションのバージョンを2から1に変更しました。違うエラーが出ました: '[INSTALL_FAILED_VERSION_DOWNGRADE]'だから私は混乱しています。このエラーは私が前に持っていたものと同じ意味ですか? '[INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE]'?私はこれらのエラーの違いは何か不思議です。 – SPottuit

7

ソリューション:

私は自分のデバイスからの私のアプリをアンインストールすることで、エラーを取り除くことができました。

原因:おそらく、エラーの原因を

は私がSDK Managerで私のAndroidのSDKを更新していることです。

0

私は特定のエミュレータプロファイルを使用してAndroidのためTACOとデバッグを使用してVS2015で、このエラーを得た:正確に状況を説明してI found this link。私はVSエミュレータ10.1" マシュマロ(6.0.0)XHDPIタブレットプロジェクトでしたツール - > Visual Studio Emulator for Android - >プロファイルのアンインストール - このプロファイルをアンインストールして再インストールすると、この問題が解決されました。私のアプリが入っていて、エラーが消えてしまった。それは、リモートデバイスからアプリをアンインストールするのと同等のVSエミュレータだと思います。