Package has mismatched uid: 10124 on disk, 10134 in settings

Problem definition

During standard installation, a program called "dexopt" runs to prepare your app for the specific phone it's being installed on. Dexopt uses a fixed-size buffer (called the "LinearAlloc" buffer) to store information about all of the methods in your app. Recent versions of Android use an 8 or 16 MB buffer, but Froyo and Gingerbread (versions 2.2 and 2.3) only have 5 MB. Because older versions of Android have a relatively small buffer, our large number of methods was exceeding the buffer size and causing dexopt to crash.

This is the bug for your issue

Solutions:

  1. Proguard: Proguard removes unreferenced classes/methods from your app. Thus your app's dex file size decreases. (I've solved my problem with proguard)
  2. Multiple Dex Files: Split your app to multiple dex files. Facebook has a solution for this. Also read this link for managing multiple dex files.

Your problem is that the API you defined in your project settings has to be compatible to properly work with your phone version, which has to match or be supported by the APK build version you are currently using. So, check AndroidManifest.xml and included .jar settings for API compatibility. A good way to go safe and avoid this kind of headache is to publish multiple APKs.

enter image description here

Once you decide to publish multiple APKs, you probably need to create separate Android projects for each APK you intend to publish so that you can appropriately develop them separately. You can do this by simply duplicating your existing project and give it a new name. Alternatively, you might use a build system that can output different resources—such as textures—based on the build configuration.

enter image description here

One way to avoid duplicating large portions of your application code is to use a library project. A library project holds shared code and resources, which you can include in your actual application projects.

enter image description here
(source: technotalkative.com)

When creating multiple projects for the same application, it's a good practice to identify each one with a name that indicates the device restrictions to be placed on the APK, so you can easily identify them. For example, "myAPP08" might be a good name for an application designed for API level 8 and above.

enter image description here
(source: se-mc.com)

To activate multiple APK in the Developer console for Android Market, ensure you have the provide APK versions to match the Android versions you have in mind. Using library project is an extra step that helps you ensure quality and avoid problem of compatibility, when preparing to release your App. The more careful and keen on paying attention to details, the better.

enter image description here

In the end, what matters most is that you APK will be reliable and run smoothly on a larger number of different devices.

Tags:

Android

Dexopt