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

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

报错

Android Studio报错提示:

Error running 'app'

The application could not be installed: INSTALL_FAILED_TEST_ONLY

手机报错提示:

修复

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

android.injected.testOnly = false

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

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

<!-- 权限声明 -->
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />

猜你喜欢

转载自blog.csdn.net/u012881779/article/details/134359771
今日推荐