INSTALL_FAILED_INVALID_APK error with debug versio

2019-04-29 17:52发布

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.

2条回答
\"骚年 ilove
2楼-- · 2019-04-29 18:23

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

查看更多
孤傲高冷的网名
3楼-- · 2019-04-29 18:31

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.

查看更多
登录 后发表回答