请转载的朋友表明出处:

http://blog.csdn.net/shift_wwx/article/details/78468397


平台版本是android 7.0,在adb install *.apk 会提示下面的错误:

 Failure [INSTALL_FAILED_TEST_ONLY: installPackageLI]


方法1:

修改AndroidManifest.xml 中android:testOnly="true" 改成 android:testOnly="false",或者直接去掉。


方法2:

adb push *.apk /tmp

adb shell pm install -t /tmp/*.apk


方法3:

adb install -t *.apk


方法4:

Android Studio 3.0 and FLAG_TEST_ONLY  一文中,给出了关于Android studio 3.0中出现问题的说明:

Option to indicate this application is only for testing purposes.For example, it may expose functionality or data outside of itself that would cause a security hole, but is useful for testing.This kind of application can not be installed without the INSTALL_ALLOW_TEST flag, which means only through adb install.
1. You cannot install an app with android:testOnly="true" by conventional means, such as from an Android file manager or from a download off of a Web site2. Android Studio 3.0 sets android:testOnly="true" on APKs that are run from the IDE

解决办法: 在gradle.properties(项目根目录或者gradle全局配置目录 ~/.gradle/)文件中添加:
android.injected.testOnly=false


参考文献:

https://commonsware.com/blog/2017/10/31/android-studio-3p0-flag-test-only.html

https://stackoverflow.com/questions/25274296/adb-install-fails-with-install-failed-test-only

更多相关文章

  1. android 解析 xml 文档的三种方法
  2. 几个Android小错误解决方法
  3. android读取assets大于1M文件的解决方法
  4. Android 通知Notification的两种实现方法
  5. android监听键盘弹出or隐藏方法
  6. Android 图片压缩的方法大全
  7. android Gide加载webp图片方法
  8. Android Battery一些信息获取方法
  9. CheckBox android:paddingLeft 不兼容问题解决方法

随机推荐

  1. android 关于Dialog 圆角的问题
  2. android编程中的琐碎知识点汇总(2)
  3. Android(安卓)开发中使用SQLite 数据库
  4. Android源代码下载
  5. linux下操作android模拟器命令
  6. 如何在mac本上安装android sdk
  7. Android笔试总结
  8. Analyzing Android(安卓)Malware
  9. Android(安卓)Gradle manifestPlaceholde
  10. android top 10 library1