ADB Install Fails With INSTALL_FAILED_TEST_ONLY
Looks like you need to modify your AndroidManifest.xml
Change android:testOnly="true"
to android:testOnly="false"
or remove this attribute.
If you want to keep the attribute android:testOnly
as true
you can use pm install
command with -t
option, but you may need to push
the apk to device first.
$ adb push bin/hello.apk /tmp/
5210 KB/s (825660 bytes in 0.154s)
$ adb shell pm install /tmp/hello.apk
pkg: /tmp/hello.apk
Failure [INSTALL_FAILED_TEST_ONLY]
$ adb shell pm install -t /tmp/hello.apk
pkg: /tmp/hello.apk
Success
I was able to reproduce the same issue and the above solved it.
If your APK is outside the device (on your desktop), then below command would do it:
$ adb install -t hello.apk
getting Failure [INSTALL_FAILED_TEST_ONLY: installPackageLI] in Android studio 3.0
If you really want to be able to remove the test flag from the APK generated in Android Studio, you could try adding the following to your gradle.properties file:
android.injected.testOnly = false
Failed to install APK with INSTALL_FAILED_TEST_ONLY
Goto Build
-> Build APK(s)
and locate your APK
file in your project->app->build->outputs->apk->debug->app-debug.apk. It will work for every android device
ADB Install Fails With INSTALL_FAILED_TEST_ONLY
Looks like you need to modify your AndroidManifest.xml
Change android:testOnly="true"
to android:testOnly="false"
or remove this attribute.
If you want to keep the attribute android:testOnly
as true
you can use pm install
command with -t
option, but you may need to push
the apk to device first.
$ adb push bin/hello.apk /tmp/
5210 KB/s (825660 bytes in 0.154s)
$ adb shell pm install /tmp/hello.apk
pkg: /tmp/hello.apk
Failure [INSTALL_FAILED_TEST_ONLY]
$ adb shell pm install -t /tmp/hello.apk
pkg: /tmp/hello.apk
Success
I was able to reproduce the same issue and the above solved it.
If your APK is outside the device (on your desktop), then below command would do it:
$ adb install -t hello.apk
INSTALL_FAILED_TEST_ONLY in Android studio 2.4 preview 7
If you analyze your apk file you'll see the problem easily - namely that when building the project with the mentioned Android Studio version, the Gradle plugin is automatically injecting an android:testOnly=true
to the final AndroidManifest.xml
file of the output apk.
You can read more about this property and what it's used for HERE.
To workaround this problem - you can still install the app using this command:
adb install -t debug.apk
If you want to build a signed release
version of your app (e.g. for publishing the Play Store), you can always do so via Build -> Generate Signed APK
. The result is an apk without the mentioned property and can be installed on any device.
If you want a bit of context why this property is injected, perhaps check THIS and THIS issues on the AOSP bug tracker.
Related Topics
Write to /Res/Drawable/ on the Fly
Disable Orange Outline Highlight on Focus
Fragments in Android 2.2.1, 2.3, 2.0. Is This Possible
How to Display Image in Android's Textview
Open Soft Keyboard Programmatically
Change Actionbar Color Programmatically More Than Once
Accessing Contents of R.String Using a Variable to Represent the Resource Name
Is It Possible Query Data That Are Not Equal to the Specified Condition
How to Animate View.Setvisibility(Gone)
Add Floating Point Value to Android Resources/Values
How to Create Custom UI for Android Mediacontroller
Hiding the Actionbar on Recyclerview/Listview Onscroll
How to Display Progress While Loading a Url to Webview in Android
Programmatically Obtain the Android API Level of a Device
Checkselfpermission Method Is Not Working in Targetsdkversion 22