What's the cause of "Application not installed" error? So I just downloaded the nightly version of Firefox (ARMv6) apk and when I install, I get the following error message:-



This, isn't a very friendly message.. what could be the cause? How do I find out?

Logcat for this particular problem says:-

W/PackageParser(  137): Exception reading libxul.so in /data/app/vmdl70897.tmp
W/PackageParser(  137): java.io.IOException
W/PackageParser(  137):         at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:207)
W/PackageParser(  137):         at java.util.zip.ZipFile$ZipInflaterInputStream.read(ZipFile.java:432)
W/PackageParser(  137):         at java.io.FilterInputStream.read(FilterInputStream.java:154)
W/PackageParser(  137):         at java.util.jar.JarFile$JarFileInputStream.read(JarFile.java:109)
W/PackageParser(  137):         at android.content.pm.PackageParser.loadCertificates(PackageParser.java:338)
W/PackageParser(  137):         at android.content.pm.PackageParser.collectCertificates(PackageParser.java:508)
W/PackageParser(  137):         at com.android.server.PackageManagerService.installPackageLI(PackageManagerService.java:5906)
W/PackageParser(  137):         at com.android.server.PackageManagerService.access$2100(PackageManagerService.java:134)
W/PackageParser(  137):         at com.android.server.PackageManagerService$5.run(PackageManagerService.java:4764)
W/PackageParser(  137):         at android.os.Handler.handleCallback(Handler.java:587)
W/PackageParser(  137):         at android.os.Handler.dispatchMessage(Handler.java:92)
W/PackageParser(  137):         at android.os.Looper.loop(Looper.java:123)
W/PackageParser(  137):         at android.os.HandlerThread.run(HandlerThread.java:60)
W/PackageParser(  137): Caused by: java.util.zip.DataFormatException: data error    
W/PackageParser(  137):         at java.util.zip.Inflater.inflateImpl(Native Method)
W/PackageParser(  137):         at java.util.zip.Inflater.inflate(Inflater.java:255)
W/PackageParser(  137):         at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:188)
W/PackageParser(  137):         ... 12 more    
E/PackageParser(  137): Package org.mozilla.fennec has no certificates at entry libxul.so; ignoring!


Although I've encountered this on the Firefox APK, I'd prefer a more general answer on how to fix or know the cause of such "Application not installed" problem.
The exceptions coming from zip (in the log extract) indicate that the package is corrupt. This error could have been introduced by the download, or when the package file was generated. You could check for download errors by verifying the APK file's SHA-1 or MD5 checksum against a checksum provided by the download site. Obviously each site will have a different way of telling you the checksum. Also, the method of verifying it is different depending on what OS your PC runs: on Linux it's as simple as running md5sum file or sha1sum file.

Note that this won't always be the case from the "Application not installed" error message. As others have indicated, that message usually results from trying to install a package that already exists on the system, unless the new package has a newer version number and is signed by the same key.