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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With