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?
After searching and browsing all day, the only one works is adding
to the gradle.properties file
As mentioned in documentation:
So, to be able to install your apk with
adb install <path to apk file>
you need to assemble build from terminal:./gradlew assembleDebug
and install with adb. Or just run./gradlew installDebug
to build and install on the device simultaneously.this works for me adb install -t myapk.apk
Add
-t
install flag, as on the screenshot below:My finding is as below. If I compile using the Android Studio UI, and the APK generated, I can't just
It will generate
Failure [INSTALL_FAILED_TEST_ONLY]
I need to compile it using the gradle i.e.
./gradlew app:assembleRelease
. Then only the generated apk, then it can only be installed.This is because the Android Studio UI Compile, only generate test apk for a particular device, while
./gradlew app:assembleRelease
command is the actual apk generation to be installed on all device (and upload to playstore)Although I am sure Saurabh's answer will work for most other people, I did want to identify the extra steps I had to take in order to get my apk installed.
I tried pushing to the device with the following result:
After looking around to change the filesystem RW permissions I ended up executing the following commands:
I got this when I tried to push again:
I was able to push to the sdcard:
At which point I was able to execute Saurabh's command: