getting Failure [INSTALL_FAILED_TEST_ONLY: installPackageLI] in Android studio 3.0

AADProgramming picture AADProgramming · Jan 20, 2018 · Viewed 28.5k times · Source

As per this blogpost from CommonsWare, AndroidManifest.xml file can have an android:testOnly attribute.

In my AndroidManifest.xml it is set as "false"

android:testOnly="false"

And I am generating the apk file using the “Build APK(s)” menu option as shown below image,

enter image description here

And when i am trying to install app from command line, adb install -r myapp.apk, I am still getting error,

Failure [INSTALL_FAILED_TEST_ONLY: installPackageLI]

Android studio version is as below, enter image description here

What else shall I do to make my app run?

Answer

Languoguang picture Languoguang · Jun 21, 2018

You can also use command like this :

adb install -r -t myapp.apk

it works for me:

PS C:\Users\languoguang> adb -P 12345 install -r D:\GreeneTrans\HelloWorld-signed.apk
adb: failed to install D:\GreeneTrans\HelloWorld-signed.apk: Failure [INSTALL_FAILED_TEST_ONLY: installPackageLI]
PS C:\Users\languoguang> adb -P 12345 install -t D:\GreeneTrans\HelloWorld-signed.apk
Success
PS C:\Users\languoguang> adb -P 12345 install -r -t D:\GreeneTrans\HelloWorld-signed.apk
Success
PS C:\Users\languoguang>