ADB安装因INSTALL_FAILED_TEST_ONLY而失败 [英] ADB Install Fails With INSTALL_FAILED_TEST_ONLY

查看:156
本文介绍了ADB安装因INSTALL_FAILED_TEST_ONLY而失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在将apk安装到我的设备时遇到问题。

I am having issues installing an apk to my device.

adb install <.apk>

使用上述命令将返回以下内容:

Using the above command returns the following:

5413 KB/s (99747 bytes in 0.017s)
        pkg: /data/local/tmp/AppClient.TestOnly.App3.apk
Failure [INSTALL_FAILED_TEST_ONLY]

任何可能导致此问题的想法?

Any idea on what might cause this issue?

它肯定可以识别设备。可能是apk的问题吗?

It definitely recognizes the device. Could it be an issue with the apk?

推荐答案

看起来您需要修改 AndroidManifest.xml

android:testOnly = true 更改为 android:testOnly = false 或删除此属性。

Looks like you need to modify your AndroidManifest.xml
Change android:testOnly="true" to android:testOnly="false" or remove this attribute.

如果要保留属性 android:testOnly true 您可以使用 pm install 命令和 -t 选项,但是,您可能需要先将apk 推送到设备。

If you want to keep the attribute android:testOnly as true you can use pm install command with -t option, but you may need to push the apk to device first.

$ adb push bin/hello.apk /tmp/
5210 KB/s (825660 bytes in 0.154s)

$ adb shell pm install /tmp/hello.apk 
    pkg: /tmp/hello.apk
Failure [INSTALL_FAILED_TEST_ONLY]

$ adb shell pm install -t /tmp/hello.apk 
    pkg: /tmp/hello.apk
Success

我能够重现相同的问题解决了它。

I was able to reproduce the same issue and the above solved it.

如果您的APK在设备外部(在您的桌面上p),则可以使用以下命令执行此操作:

If your APK is outside the device (on your desktop), then below command would do it:

$ adb install -t hello.apk

这篇关于ADB安装因INSTALL_FAILED_TEST_ONLY而失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆