INSTALL_FAILED_INVALID_APK error with debug version code 1 inconsistent with 0

我与影子孤独终老i 提交于 2019-12-07 07:56:46

问题


I have built an Android app on Android Studio version 2.3.3. As I try to deploy the app to a phone (lennovo) or an emulator (GenyMotion) I get an error, which says:

INSTALL_FAILED_INVALID_APK: /data/app/vmdl235652946.tmp/4_yCommerceApp-b_c-dev-debug version code 1 inconsistent with 0.

I have looked at various posts here and tried the approaches below, none of which seems to help

  1. Did a clean build followed by a rebuild after a restart of the Android Studio

  2. Disconnected and reconnected devices

  3. I deleted the .idea, .gradle and build directories and built again

Any suggestions to solve this pls? What is the version code being referred to here? I see one version code in the AndroidManifest.xml like below:

<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0">      

I don't see any other version code anywhere else. BTW, I did not use an Android emulator as they seem to take hours to start. My processor is AMD and not Intel. I have the ARM images downloaded for the emulators.


回答1:


The trouble maybe caused by Instant Run feature of new Gradle.

Try disable Instant Run by going into File > Settings > Build, Execution, Deployment > Instant Run




回答2:


Some strange circumstances might cause this. That works for me:

Menu "Build" > "Rebuild Project"

Then run app on device or emulator, and error goes away.




回答3:


I have this once every so many build, I wait a few moments and then run it again. In 90% of the situations it works after that.



来源:https://stackoverflow.com/questions/44870361/install-failed-invalid-apk-error-with-debug-version-code-1-inconsistent-with-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!