Failure [INSTALL_FAILED_TEST_ONLY]

android 将debug 直接安装在手机上 ,安装失败,提示:软件包已经损坏
或者
使用命令 adb install -r xxx.apk 安装 ,报错:Failure [INSTALL_FAILED_TEST_ONLY]

原因:
Android Studio 3.0会在debug apkmanifest文件application标签里自动添加 android:testOnly="true"属性,导致IDE中run跑出的apk在大部分手机上只能用adb install -t 来安装。

解决方法一:
在项目中的gradle.properties全局配置中设置:

android.injected.testOnly=false

在这里插入图片描述

解决方法二:
使用 adb install -t 来安装

猜你喜欢

转载自blog.csdn.net/lxd_love_lgc/article/details/107731180