今天直接运行、安装到手机上,发现安装失败(adb install同样失败),提示INSTALL_FAILED_TEST_ONLY,原来是Android Studio 3.0会在debug apk的manifest文件application标签里自动添加 android:testOnly="true"属性
➜ apk adb install '/home/silver/桌面/share/apk/app-android-debug.apk'
adb server is out of date. killing...
* daemon started successfully *
5347 KB/s (8754206 bytes in 1.598s)
pkg: /data/local/tmp/app-android-debug.apk
Failure [INSTALL_FAILED_TEST_ONLY]
解决方法:
方法1、在项目中的gradle.properties全局配置中设置:
android.injected.testOnly=false
方法2、加 -t
adb install -t app-debug.apk