INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES on adb install

前端 未结 7 1057
梦毁少年i
梦毁少年i 2020-12-17 07:46

The same Android project is built in debug mode, sometimes with Eclipse, sometimes with ant (on build machine).

If I first install the ant build, and then try to sta

相关标签:
7条回答
  • 2020-12-17 08:12

    The old installed .apk has different certificate than the new going to be installed or it is already installed in your device with a different key. This means that your application was previously installed from a different machine that gave it different credentials.

    So the solution is:

    uninstall the existing .apk

    and then

    re-install the new .apk

    0 讨论(0)
  • 2020-12-17 08:13

    Open Eclipse's Preferences. Open Android section in left list. Select "Build" area under Android Beside "Custom debug store" navigate to the keystore under your Android SDK instalation, NOT the one Eclipse has selected under your home directory.

    Now the android ant build and eclipse are using the same keystore.

    0 讨论(0)
  • 2020-12-17 08:21

    For me the problem was I had the same application already installed with another key. Uninstalling the old application solved the problem, as noted here:

    https://stackoverflow.com/a/10280878

    0 讨论(0)
  • If your building system is gradle, just use the follwong command to uninstall it in Windows:

    .\gradlew.bat uninstallDebug
    

    or in Linux:

    ./gradlew uninstallDebug
    

    And then:

    ./gradlew install
    

    This is a certification check for installation and uninstallation on the same package in Android. If you are using two different building PC (computer) connected with the same phone, you'll get this error when you connect your phone with those different PCs. The best choice is binding one PC with one physical phone.

    0 讨论(0)
  • 2020-12-17 08:24

    Other solution Incremente your version code on build.gralde file of your application

     defaultConfig {
            ...
            versionCode 1
            ...
      }
    
     defaultConfig {
            ...
            versionCode 2
            ...
      }
    

    Sync Now

    Build clean Project

    Run your application

    0 讨论(0)
  • 2020-12-17 08:26

    The problem is that the apk files (during Eclipse and ant build) have been signed with different certificates. To make the signatures consistent between builds that have been built on different machines, place the debug keystore in version control:

    • Use keytool-importkeypair to make the key/certificate pair: https://stackoverflow.com/a/4257367/1097104
    • Place the created keystore file in version control
    • Set Eclipse to use the file: Windows > Preferences > Android > Build
    • Set ant properties to use the file: https://stackoverflow.com/a/9019925/1097104

    This is handy if you tend to cross-install builds from your own machine and build machine.

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