问题描述
- adb install 安装apk时,报如下错误: Failure [INSTALL_FAILED_TEST_ONLY: installPackageLI]
解决方法
方法一: 加参数 -t
adb install -t test.apk
方法二:在Android Studio项目中的gradle.properties
全局配置中设置如下,可取消自动在apk添加 android:testOnly="true" 属性。
android.injected.testOnly=false
详细分析
- Android Studio 3.0后默认在debug apk中的manifest中添加 android:testOnly="true" 属性,带该属性的apk需要使用 adb install -t 命令安装。
- 官网关于adb install -t 说明如下:
参考链接
- 禁止 android studio 3.0 自动添加android:testOnly="true"
- INSTALL_FAILED_TEST_ONLY的原因
- <application> | Android 开发者
- Android 调试桥 (adb) | Android开发者