Android: Unable to install release build onto emulator; getting Failure [INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION]
<p>I am able to install a debug build onto emulator doing:</p>

<pre><code>ant debug install
</code></pre>

<p>but am unable to install a release build. My steps:</p>

<pre><code>1. ant release
2. jarsigner -verbose -keystore ..\my-release-key.keystore bin\myapp-release-unsigned.apk mykey
3. ren bin\myapp-release-unsigned.apk bin\myapp-release-signed.apk
4. zipalign -v 4 myapp-release-signed.apk myapp-release.apk
5. adb install bin\myapp-release.apk
</code></pre>

<p>All steps run successfully except the last one where I get a message:</p>

<pre><code>82 KB/s (388012 bytes in 4.613s)
        pkg: /data/local/tmp/myapp-release.apk
Failure [INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION]
</code></pre>

<p>I have also tried doing <code>ant installr</code> instead of <code>adb install bin\myapp-release.apk</code> with the same result</p>

<p>EDIT: I think this has to do with the key, since that is the only difference I can see between release and debug builds. I generated the key using:</p>

<pre><code>keytool -genkey -v -keystore my-release-key.keystore
-alias alias_name -keyalg RSA -keysize 2048 -validity 10000
</code></pre>

<p>as mentioned on <a href="http://developer.android.com/guide/publishing/app-signing.html" rel="nofollow">http://developer.android.com/guide/publishing/app-signing.html</a>. I modified <code>ant.properties</code> file per <a href="http://developer.android.com/guide/developing/building/building-cmdline.html" rel="nofollow">http://developer.android.com/guide/developing/building/building-cmdline.html</a> and now just doing <code>ant release install</code> (instead of the steps above) but still running into same problem. If someone knows how does ant generate the debug key, then I could follow same procedure to generate my release key and see if that solves the problem.</p>
