问题描述
我已在2.3.3版的Android Studio上构建了一个Android应用.当我尝试将应用程序部署到手机(lennovo)或仿真器(GenyMotion)上时,出现错误,提示:
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
-
在重新启动Android Studio之后进行了干净的构建,然后进行了重新构建
Did a clean build followed by a rebuild after a restart of the Android Studio
断开连接并重新连接的设备
Disconnected and reconnected devices
我删除了.idea
,.gradle
并构建目录并再次构建
I deleted the .idea
, .gradle
and build directories and built again
是否有解决此问题的建议?这里指的是什么版本代码?我在AndroidManifest.xml中看到一个版本代码,如下所示:
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">
在其他任何地方都看不到任何其他版本代码.顺便说一句,我没有使用Android模拟器,因为它们似乎需要几个小时才能启动.我的处理器是AMD,而不是Intel.我已经为仿真器下载了ARM映像.
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.
推荐答案
问题可能是由新Gradle的即时运行功能引起的.
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
这篇关于调试版本代码1与0不一致的INSTALL_FAILED_INVALID_APK错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!