ADB Install Fails With INSTALL_FAILED_TEST_ONLY

evve picture evve · Aug 12, 2014 · Viewed 122k times · Source

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?

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

Answer

Saurabh Meshram picture Saurabh Meshram · Aug 13, 2014

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

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.

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

$ adb install -t hello.apk