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

查看:85
本文介绍了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:testOnlytrue 你可以使用 pm install 命令和 -t 选项,但是您可能需要先push 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 在设备外部(在您的桌面上),那么下面的命令可以做到:

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天全站免登陆