请转载的朋友表明出处:

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. 浅谈Java中Collections.sort对List排序的两种方法
  2. Python list sort方法的具体使用
  3. python list.sort()根据多个关键字排序的方法实现
  4. Android发送短信方法实例详解
  5. Android中的dispatchTouchEvent()、onInterceptTouchEvent()和on
  6. How To Open An URL In Android’s Web Browser
  7. Android(安卓)中与 Touch 事件分发和消费机制
  8. 【Android】如何用MediaPlayer实现一个简单的音视频播放器
  9. Android(安卓)Junit 单元测试步骤

随机推荐

  1. mysql数据库监控利器lepus天兔工具安装和
  2. Mysql主从复制读写分离
  3. MySQL查询返回用户的收件人列表
  4. linux系统下安装多个MySql数据库并做主从
  5. 在MySQL中盲目使用INSERT是否有缺点?
  6. 如何在列中搜索值,并在单个SQL查询中获取
  7. 最近用php写了一个从mysql数据库随机读取
  8. 创造一个多态关系与教义
  9. mysql中 character set 和collation关系
  10. Simple MySQL-C ORM - 简化C语言访问MySQ