I have a program working in the Android Emulator. Every now and again I have been creating a signed .apk and exporting it to my HTC Desire to test. It has all been fine.
create keystore file through command line
keytool -genkey -alias key_file_name.keystore -keyalg RSA -validity 1000000000000000 -keystore key_file_name.keystore
export apk through Eclipse, right click on Android project Android Tools > Export Signed Application Package, then give keystore location & password.
this will crate signed apk at the same time apk will be zipaligned. And installable.
If you go through command line for all, some times you may face "Application not installed" error. (Application not installed error can happen not only, when using command line. It can be some other reasons as well)
My problem was that I have multiple user accounts on the device. I deleted the app on 1 account, but it still was installed on the other account. Thus the namespace collided and did not install. Uninstalling the app from all user fixed it for me.
I also encountered this issue. Kindly try this solution. Make sure that the package name of your project is different from your previous project that was already installed in your mobile phone. I think they get conflict in their names. It works in me.
In my case it was because I was using the alpha version of support library 28. Looks like Google marks these pre release versions as testOnly. If you really want to release like this (for instance, you want to push an internal beta like I did), you can add this line to your gradle.properties file:
android.injected.testOnly=false
The "Application not installed" error can also occur if the app has been installed to or moved to the SD card, and then the USB cable has been connected, causing the SD card to unmount.
Turning off USB storage or moving the app back to internal storage would fix the issue in this case.
for me the cause was that i had multiple builds using different build variants on same phone:
what happened was that some of these builds were built by me, another one was sent to me by another developer.. trying to install the developers while i had other builds (built by me) caused the above error.
so the fix was simple: delete all the builds on my phone (regardless of build variant).. then install the apk sent by my peer.. and it worked like a charm