ADB Install Fails With INSTALL_FAILED_TEST_ONLY

2019-01-07 05:18发布

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?

22条回答
爷、活的狠高调
2楼-- · 2019-01-07 05:47

In my case this mistake was in unstable gradle version. Just use a stable version of gradle (not alpha, not even beta). And it was fixed for me

查看更多
做个烂人
3楼-- · 2019-01-07 05:48

Android studio 3.0 generates test only APK.

I have solved the issue by adding the "android:testOnly" property to android manifest's tag.

 <application
    .....
    android:testOnly="false"
    android:theme="@style/AppTheme">

And then generated the APK by Android studio3.0 menu:Build-->Build APK(s).

More Info: https://commonsware.com/blog/2017/10/31/android-studio-3p0-flag-test-only.html

查看更多
唯我独甜
4楼-- · 2019-01-07 05:50

Build your distribution .apk from Android Studio as follow

Build --> Build Apk(s) (for unsigned build) Build --> Generate Signed APK ( for signed build)

These option builds the APK with android:testOnly="false" option which allows you to install the APK expicitly into device by the commond.

adb install yourBuilT.apk

查看更多
在下西门庆
5楼-- · 2019-01-07 05:51

I see the accepted answer but you dont have to actually push the apk and then run the command on adb shell direct adb install with -t flag actually works

adb install -t "path to apk in ur computer"

attaching a screenshot for reference enter image description here

查看更多
登录 后发表回答