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?
What worked for me is performing
Refresh all Gradle projects
from theGradle
toolbar from the right menu.PFB the screenshot from Android Studio.
Gradle
toolbar from the right menu.Refresh
iconThis resolved the issue for me.
If you want to test the apk, just add the
-t
command line option.Example command:
I tried external project, with multiple apk.
The command from Studio, looked like
Solution -
-t
The easiest to solve this, without reverting to an older gradle version is to add the '-t' option in the run configurations (for pm install).
testOnly='false' had no effect whatsoever. The error is caused by the alpha version of gradle plugin that makes debug APK 'for test only purposes'. The -t option allows such APK to be installed. Setting it in run configuration makes it automatically install you APK as usual.
For me it has worked execute the gradle task 'clean' (under :app, at Gradle pane, usually located at the right) and run again the project.
first remove the unstable version:
adb uninstall
problematic-package-name; and then reinstall the apk.