Android Studio真机运行时提示“安装失败”

用中兴手机真机运行没问题,用Vivo运行就提示安装失败。前提,手机已经打开了调试模式。

报错

Android Studio报错提示:

Error running 'app'

The application could not be installed: INSTALL_FAILED_TEST_ONLY

手机报错提示:

修复

在gradle.properties文件添加如下代码

Kotlin 复制代码
android.injected.testOnly = false

正常来说,上面添加后就能安装了。

若仍无法安装,可以到AndroidManifest.xml中添加权限声明。

Kotlin 复制代码
<!-- 权限声明 -->
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
相关推荐
Coffeeee34 分钟前
如何使用Glide和Coil加载WebP动图
android·kotlin·glide
Kapaseker1 小时前
5 分钟搞懂 Kotlin DSL
android·kotlin
恋猫de小郭2 小时前
AI Agent 开发究竟是啥?如何用 AI 开发 Agent ?深入浅出给你一套概念
android·前端·ai编程
黄林晴2 小时前
Android 17 正式发布!target 37 一大批旧代码直接不能用了
android
Carson带你学Android2 小时前
Android 17 正式发布:AI 终于成了系统能力
android·前端·ai编程
三少爷的鞋3 小时前
当 UseCase 开始长期监听,它可能已经不是 UseCase 了
android
恋猫de小郭16 小时前
Android 限制侧载新进展,谷歌联合国内厂商推验证计划
android·前端·flutter
恋猫de小郭16 小时前
解读 Android 17 全新内存限制,有没有“豁免”后门?
android·前端·flutter
贾艺驰19 小时前
实战Android Framework: 新增一个系统权限
android
alexhilton1 天前
使用Android Archive进行打包
android·kotlin·android jetpack