2016-01-14 4 views
12

Ich habe den folgenden Befehl im CMD eingegeben und der Befehl hat den Fehler unter dem Befehl zurückgegeben.Fehler [INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE]

Befehl:

phonegap run android --verbose --stacktrace 

Fehler:

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

Seine sehr nützliche Abfrage.Ich suchte nach th ist. –

Antwort

30

Das Problem dort ist, dass Sie versuchen, eine Version Ihres APK zu installieren, die WENIGER als das ist, was bereits auf Ihrem Gerät ist.

Deinstallieren wird sicherlich das Problem für Sie beheben.

ADB ermöglicht mehr Flexibilität adb install -r -d <apk path>, aber ich bin mir nicht sicher, dass Phonegap diese Funktionalität hat.

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) 

Update:

Es stellt sich heraus, dass für die Herabstufung der App-Version nicht die richtige Fehlermeldung war. Tatsächlich ist es etwas völlig anderes. Ich found this link, die die Situation genau erklärt:

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

Wo steht das ** - r **? Ich finde es nicht in [der Android-Debug-Bridge-Dokumentation von developer.android.com] (http://developer.android.com/tools/help/adb.html). Kannst du auch sagen, was du mit 'version' meinst? Es ist ein bisschen vage. – SPottuit

+0

Ich habe meine Frage zu Reflex die Option Bedeutung aktualisiert. Mit Version meine ich deine App-Version. Wenn Sie App Version 3 installiert haben und versuchen, App Version 2 zu installieren. Es wird es nicht ohne Hte-Degradationsflag zulassen. – Knossos

+0

Ich habe deine Theorie getestet. Ich änderte meine App-Version von 2 zu 1 und ich bekam einen anderen Fehler: '[INSTALL_FAILED_VERSION_DOWNGRADE]' so bin ich verwirrt. Bedeutet dieser Fehler das gleiche wie zuvor? '[INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE]'? Ich bin gespannt was der Unterschied zwischen diesen Fehlern ist. – SPottuit

7

Lösung:

ich es geschafft, die Fehler loszuwerden, indem meine App von meinem Gerät zu deinstallieren.

Ursache:

Was wahrscheinlich den Fehler verursacht hat, ist, dass ich mit SDK Manager mein Android SDK aktualisiert.

0

ich diesen Fehler bekam in VS2015 mit TACO und Debugging für Android ein bestimmtes Emulator Profil mit:. VS Emulator 10.1" Eibisch (6.0.0) XHDPI Tablet Das Projekt war ich Ich habe das Problem gelöst, indem ich das betreffende Profil deinstalliert und neu installiert habe: Extras -> Visual Studio Emulator für Android -> Profil deinstallieren Das neu installierte Profil nicht mehr enthielt meine App und der Fehler ging weg.Es ist das VS-Emulator-Äquivalent der Deinstallation der App von einem Remote-Gerät, denke ich.