Android Emulator: Installation error: INSTALL_FAILED_VERSION_DOWNGRADE

后端 未结 15 1488
旧巷少年郎
旧巷少年郎 2020-12-12 11:16

I am currently trying to compile and test a small Android Application.

I am using Eclipse, and have SDK 4.2 (Api Level 17) installed. I\'ve set

<         


        
相关标签:
15条回答
  • 2020-12-12 11:38

    You can also consider adding -d flag to adb install. It should ignore this error.

    adb install -r -d abc.apk
    
    0 讨论(0)
  • 2020-12-12 11:40

    It may be a problem with the Google Play Services dependencies rather than an actual app version issue.

    Sometimes, it is NOT the case that:

    a) there is an existing version of the app installed, newer or not b) there is an existing version of the app installed on another user account on the device

    So the error message is just bogus.

    In my case, I had:

    implementation 'com.google.android.gms:play-services-maps:16.0.0'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.google.android.gms:play-services-gcm:16.0.0'
    

    But when I tried

    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation 'com.google.android.gms:play-services-location:17.0.0'
    implementation 'com.google.android.gms:play-services-gcm:17.0.0'
    

    I got androidX related errors, as I had not yet upgraded to androidX and was not ready to do so. I found that using the latest 16.x.y versions work and I don't get the error message any more. Furthermore, I could wait till later when I am ready, to upgrade to androidX.

    implementation 'com.google.android.gms:play-services-maps:16.+'
    implementation 'com.google.android.gms:play-services-location:16.+'
    implementation 'com.google.android.gms:play-services-gcm:16.+'
    
    0 讨论(0)
  • 2020-12-12 11:43

    According to sdk src code from ...\android-22\android\content\pm\PackageManager.java

    /**
     * Installation return code: this is passed to the {@link IPackageInstallObserver} by
     * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} if
     * the new package has an older version code than the currently installed package.
     * @hide
     */
    public static final int INSTALL_FAILED_VERSION_DOWNGRADE = -25;
    

    if the new package has an older version code than the currently installed package.

    0 讨论(0)
提交回复
热议问题