Where did the code in apk file go after installed from Market?
<p>This is a very interesting thing. I have an APK file, com.company.app.apk. When installed to an emulator by using Eclipse, by using the following code to get the apk's file name:</p>

<pre><code>String fileName = activity.getPackageManager().getApplicationInfo(
    activity.getPackageName(), PackageManager.GET_META_DATA).publicSourceDir;
</code></pre>

<p>I get a pathname like this <code>com.company.app-1.apk</code>. The file size is the same as the apk file I built.</p>

<p>Now when I publish this app to Market, and install it to a real device (Android 2.3), the same code returned a pathname like this: <code>com.company.app-2.zip</code>. Note that the file extension has changed to .zip and, most importantly, the file size is significantly smaller than the original size.</p>

<p>Now if I transfer these two files to my PC and use WinZip to open them, I found one really interesting thing:</p>

<p>The one installed on emulator by Eclipse has exactly the same stuff as I expected. Namely: the code ('com' folder), the resource ('res' folder), the signature ('META-INF' folder), the assets ('assets' folder), and the manifest file (AndroidManifest.xml). However, the one installed on a real device by Market has only two parts: the resource, and the manifest file.</p>

<p><strong>Question:</strong> I think when installed from Market, the .apk file is split into two (or more) files. One file is pointed to by <code>ApplicationInfo.publicSourceDir</code>, which contains only the resource. How can I get the pathname to the other file(s)?</p>

<p><strong>ADDED:</strong> I have two versions of the same app, one is paid using Google's Vendor Licensing Service, the other is free. The above mentioned phenomenon happens only to the paid version. Why?</p>

<p><strong>Correction:</strong> When I said the 'com' folder exists in the installed apk file in the first case, I should be more clear. The code per se, the *.java files, are not in the 'com' folder. As a matter of fact, the 'com' folder contains only a few garbage files that were inadvertently left there during the build process. If not for those garbage files, I don't think the 'com' folder would be there in the first place.</p>
