Google Play Error -504 INSTALL_PARSE_FAILED_NOT_APK
<p>I have built a release APK of my app. </p>

<p>If I try to install it from Play Store I get <a href="https://i.stack.imgur.com/jzn0E.png" rel="nofollow noreferrer">Error -504</a>. Users have also reported to have the same problem.</p>

<p>I was able to catch logcat from the failure:</p>

<pre><code>04-18 10:22:41.487 3713-3713/? I/Finsky: [1] com.google.android.finsky.download.DownloadBroadcastReceiver.a(45): Intent received at DownloadBroadcastReceiver
04-18 10:22:41.505 3713-3713/? I/Finsky: [1] com.google.android.finsky.download.x.b(404): com.faendir.kepi.vpviewer: onProgress 1842784/1842784 Status: 200.
04-18 10:22:41.507 3713-3713/? I/Finsky: [1] com.google.android.finsky.download.e.a(244): com.faendir.kepi.vpviewer from 2 to 3.
04-18 10:22:41.519 3713-3713/? I/Finsky: [1] com.google.android.finsky.download.x.b(603): com.faendir.kepi.vpviewer: onComplete
04-18 10:22:41.523 3713-3713/? I/Finsky: [1] com.google.android.finsky.download.x.i(344): Download com.faendir.kepi.vpviewer removed from DownloadQueue
04-18 10:22:41.524 308-308/? I/installd: free_cache(0) avail 1213521920
04-18 10:22:41.525 3713-3713/? I/Finsky: [1] com.google.android.finsky.receivers.v.c(24906): Prepare to copy com.faendir.kepi.vpviewer (com.faendir.kepi.vpviewer) from content://downloads/my_downloads/2469 (expect 1842784 bytes, isGzipped: false)
04-18 10:22:41.657 3713-3764/? I/Finsky: [8067] com.google.android.finsky.receivers.y.a(2959): com.faendir.kepi.vpviewer (com.faendir.kepi.vpviewer) (1842784 bytes) copied successfully in 116 ms
04-18 10:22:41.762 3713-3713/? I/Finsky: [1] com.google.android.finsky.receivers.y.onPostExecute(4040): Successfully copied APK to update com.faendir.kepi.vpviewer (com.faendir.kepi.vpviewer)
04-18 10:22:41.763 3713-3713/? I/Finsky: [1] com.google.android.finsky.receivers.v.c(28120): Begin install of com.faendir.kepi.vpviewer

                                         [ 04-18 10:22:41.782  1102: 1159 W/         ]
                                         Zip: missed a central dir sig (at 0)
04-18 10:22:41.782 1102-1159/? W/zipro: Error opening archive /data/app/vmdl2071847660.tmp/com.faendir.kepi.vpviewer: Iteration ended
04-18 10:22:41.782 1102-1159/? D/asset: failed to open Zip archive '/data/app/vmdl2071847660.tmp/com.faendir.kepi.vpviewer'
04-18 10:22:41.791 1102-1159/? E/PackageInstaller: Commit of session 2071847660 failed: Failed to parse /data/app/vmdl2071847660.tmp/com.faendir.kepi.vpviewer
04-18 10:22:41.816 3713-3713/? E/Finsky: [1] com.google.android.finsky.installer.x.onReceive(2496): Error -504 while installing com.faendir.kepi.vpviewer: INSTALL_PARSE_FAILED_NOT_APK: Failed to parse /data/app/vmdl2071847660.tmp/com.faendir.kepi.vpviewer
04-18 10:22:41.816 3713-3713/? W/Finsky: [1] com.google.android.finsky.receivers.ah.a(2152): Install failure of com.faendir.kepi.vpviewer: -504 null
04-18 10:22:41.823 3713-3713/? I/Finsky: [1] com.google.android.finsky.receivers.v.a(766): Cancel running installation of com.faendir.kepi.vpviewer (com.faendir.kepi.vpviewer)
</code></pre>

<p>Does anyone know what could cause this?</p>

<p>Note 1: If I install the APK from external storage it works without problem.</p>

<p>Note 2: I have seen <a href="https://stackoverflow.com/questions/34196735/google-play-error-code-504">this</a> question, and this is not the problem.</p>

<p>Note 3: Google doesn't give anything useful when searching for <code>INSTALL_PARSE_FAILED_NOT_APK</code>, which seems to be the core problem to me.</p>