【错误记录】手机中调试程序报错 ( The application could not be installed: INSTALL_FAILED_TEST_ONLY )





一、报错信息



在这里插入图片描述

17:18	Gradle build finished in 2 s 904 ms

17:18	Failed to commit install session 1905086282 with command cmd package install-commit 1905086282. Error: INSTALL_FAILED_TEST_ONLY

17:18	Error
		Installation did not succeed.
		The application could not be installed: INSTALL_FAILED_TEST_ONLY
		Retry

17:18	Session 'app': Installation did not succeed.
		The application could not be installed: INSTALL_FAILED_TEST_ONLY
		Retry




二、解决方案




1、问题分析


点击 在这里插入图片描述 按钮运行调试程序时 , 会在 清单文件的 application 标签中自动生成

android:testOnly="true"

属性 , 有些手机不支持此类应用安装 ;


2、解决方案一


在 " 菜单栏 / Build " 下 :

  • 使用 Build APK(s) 编译的调试版应用可以运行 ;
  • 使用 Make Project 编译的调试版应用可以运行 ;
  • 使用 Generate Signed APK 签名打包的发布版本应用也可以运行 ;

在这里插入图片描述


3、解决方案二


在 gradle.properties 中配置

android.injected.testOnly=false

内容 ;

猜你喜欢

转载自blog.csdn.net/han1202012/article/details/126528954