Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

INSTALL_FAILED_TEST_ONLY in Android studio 2.4 preview 7

I'm using Android Studio 2.4 preview 7 version. But, when I build debug apk and install via adb command or put apk file in sdcard of device it always gives me same error "App not installed" in any of android phone. I have got INSTALL_FAILED_TEST_ONLY error in Android Logcat every time at the time of installation in any android device.

like image 539
Darshan Mistry Avatar asked May 15 '17 13:05

Darshan Mistry


1 Answers

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.

like image 176
Vesko Avatar answered Nov 19 '22 14:11

Vesko