Android Studio: Failure INSTALL_FAILED_TEST_ONLY

Starting application from Android Studio may fail with the mysterious message: Installation failed with message INSTALL_FAILED_TEST_ONLY.

The IDE will prompt you whether you want to uninstall the existing application.

Even this uninstallation may fail. When you open Run console, you can see something like this:

$ adb shell pm uninstall rocks.georgik.sdlapp
$ adb shell pm install -r "/data/local/tmp/rocks.georgik.sdlapp"
	pkg: /data/local/tmp/rocks.georgik.sdlapp
Failure [INSTALL_FAILED_TEST_ONLY]

$ adb shell pm uninstall rocks.georgik.sdlapp
DELETE_FAILED_INTERNAL_ERROR
Error while Installing APK

Potential Fix #1

There is a relatively simple fix to this issue. Click drop-down menu with your configuration and choose Edit Configurations…

Select tab General and add -t to Install Flags field. Click Ok.

Now start the application again and it should work.

Potential fix #2

This error migh occur if you moved the project from other computer where it was stored in different directory. To resolve the problem: Clean the project and build it again.

If this article didn’t help you to resolve your issue with Android Studio please let me know in comments below. There might be also other reasons for the error and we can discuss them.

One Reply to “Android Studio: Failure INSTALL_FAILED_TEST_ONLY”

  1. “-t” doesn’t work for me, though I have same error

    Go to “Settings” -> “Build, execution, deployment” and disable “instant run to hot swap code…”

    This solved my problem, but, unfortunately, hot swapping isn’t working anymore

Comments are closed.