"Parse Error : There is a problem parsing the package" while installing Android application

Android

Android Problem Overview


I got this error while installing the android application (Parse Error : There is a problem parsing the package.). I did the following steps.

  1. First time I installed the application and it works fine.

  2. I made changes to the existing application and change the version no in Manifest file.

     <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.openintents.samples.BasicOpenARDemo" android:versionCode="2" android:versionName="1.0.1">
    
  3. Then I export the application and finish the code signing process. For this, Right Click your Project node > select Export. There you will see a wizard. Follow the steps and finish the code signing also.

  4. I got the ARDemo.apk file, Then I changed it’s name to ARDemo1.apk

  5. Then I shipped this apk file to mobiles SD Card and started the installation I got the above error.

I googled, they say that problem with unpacking manifest file.

Can anyone tell me what could be wrong with me?

Android Solutions


Solution 1 - Android

You said that the first time you installed the application it worked fine.

The only difference in the steps you outlined between the two versions are:

  1. The version number (I'm assume that this did not participate in breaking anything)
  2. The code
  3. The name of the .apk file

Try renaming the ARDemo1.apk file back to ARDemo.apk (make sure to back up the older version) and see if that helps. My guess is that it has something to do with the name of the apk.

If it still does not work, then you can eliminate the name of the apk file as the source of the problem and start investigating 2) by rebuilding your old version and see if you have same problem again. If the problem does not exists with the rebuilt version of your old code then you know it must be something to do with your code.

I hope that gets you somewhere.

Cheers, Joseph

Solution 2 - Android

Installation can give the specified error at least in following cases:

  • Name of the package is changed after signing: Use the exact name as the signed package is (instead, adjust the name in Manifest)
  • Package is compiled against on higher API level: Correct the API level in Manifest file
  • Package is executed from SD-card: Run (install) the apk -file from phones memory OR use adb command to install it

Solution 3 - Android

I've only seen the parsing error when the android version on the device was lower than the version the app was compiled for. For example if the app is compiled for android OS v2.2 and your device only has android OS v2.1 you'd get a parse error when you try to install the app.

Solution 4 - Android

Instead of shooting in the dark, get the reason for this error by installing it via adb:

adb -s emulator-5555 install ~/path-to-your-apk/com.app.apk

Replace emulator-5555 with your device name. You can obtain a list using:

adb devices

Upon failing, it will give a reason. Common reasons and their fixes:

  1. INSTALL_PARSE_FAILED_NO_CERTIFICATES: Reference
  2. INSTALL_FAILED_UPDATE_INCOMPATIBLE: Reference

Solution 5 - Android

The reason is apk is not signed. Once the apk is signed, the issue will be resolved. http://ionicframework.com/docs/guide/publishing.html Please use the link on instructions to sign the apk.

Solution 6 - Android

If you're compiling and exporting your apk file under SDK version 2.1, it will not work on any android version below your SDK export "2.1". Android software is forward compatible not backward compatible. For example if you're programming using the android NDK (ann add-on to the android SDK) package that allows development in the C/C++ family, this is only compatible with android 2.3, android version 2.2 and below support java builds only. Therefore you will reaceive the "There is a problem parsing the package" error.

Solution 7 - Android

Check whether your device supports the version you specified in minSdkVersion in AndroidManifest.xml . If not specify the lower version and try again

Solution 8 - Android

I'm not repeating what is instructed here to input the Key store, password, etc. Try

> Build -> Generate Signed APK -> [ Input ] ---Next---> select BOTH

  • V1 (Jar Signature)
  • V2 (Full APK Signature)

I don't know why, but at least it worked in my situation.

Solution 9 - Android

Another possibility is that you have saved the apk file into application PRIVATE folder and then try to install (by starting an intent from your code). in this case, when you start intent, you get error parsing package. In this case, the raised error is about permission issues. The point is saving the file into private folders is not a good practice, however if you really want to do that, you should write file in MODE_WORL_READABLE when you download it. Please consider that MODE_WORLD_READABLE is deprecated and this solution is not the best as it has some security issues. The best is to save your file in an external storage.

Solution 10 - Android

I got the same error (Parse Error, There is a problem parsing the package) while trying to install an .apk package from email. I was able to get around the problem by installing the 3rd party package installer ApKatcher:

http://www.addictivetips.com/mobile/install-android-apps-from-gmail/

ApKatcher isn't the only solution. A colleague of mine got around the problem by installing Astro File Manager.

You can find both applications in the Android Marketplace.

Solution 11 - Android

And just to help possible new readers, another reason may be errors in the manifest file. I had mistyped android:service as android.service and ran into the same error...

Solution 12 - Android

Similar issue, using this "borrowed" and slightly modified code:

                Intent intent = new Intent(Intent.ACTION_VIEW);
                File newApk = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "myapp.apk");
                intent.setDataAndType(Uri.fromFile(newApk), "application/vnd.android.package-archive");
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                startActivity(intent);
                result = true;

Needed to change the file creation to this (comma instead of plus in the File constructor, was missing '/' after the download directory):

                    File newApk = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), "myapp.apk");

Solution 13 - Android

I had a bad tag pair in my manifest file.

<meta-data>
</meta-data>

Basically got in when I copied a bad meta-data sample code from payu pdf file. Crap.

Solution 14 - Android

One reason could be, that your activity'name is not defined in the manifest

    <activity
          android:name=""
          ...>
</activity>

above code was creating the same issue with me

Solution 15 - Android

Another problem causing this error can be installing APK from restricted SD card mount point /mnt/media_rw/MicroSD.

Use unrestricted mount point /Removable/MicroSD.

Solution 16 - Android

As mentioned by @Veneet Reddy install it via ADB.

Go to ADT Bundle/sdk/platform-tools past your .apk file and run command prompt as administrator.

Then run adb devices command which will list the connected devices or emulators that are running.

enter image description here

Then run adb -s yourDeviceID install yourApk.apk

enter image description here

Note: uninstall the app if you have already installed before installing again.

Solution 17 - Android

I have had this problem Parse Error : There is a problem parsing the package. I was testing on Android-8. I have same apk with same signature .Everything was same without the version number and version name. App was installing when I install it manually but this error occurred when I was downloading and installing updates programmatically. Then I have found my cause of problem.

There was an option to check [canRequestPackageInstalls ()][1] When this method returns true then app get installed successfully. It was returning false always in my case.

So first I check this and then let the user to download and install updates.

> In onCreate()

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            if (!packageManager.canRequestPackageInstalls()) {
                    startActivityForResult(
                        Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES).setData(
                            Uri.parse(String.format("package:%s", packageName))
                        ), requestCodeqInstallPackage
                    )
                } else {
                    canInstallPackage = true
                }

        }

> In onActivityResult()

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
            if (requestCode == requestCodeqInstallPackage && resultCode == Activity.RESULT_OK) {
                if (packageManager.canRequestPackageInstalls()) {
                    canInstallPackage = true
                }
            } else {
                canInstallPackage = false
                Toast.makeText(mContext, "Auto update feature will not work", Toast.LENGTH_LONG)
                    .show()
            }
    }

> Then when need to install update then-

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
   if(canInstallPackage){
      doInstallAppProcess()
   }else{
        // generate error message
   }
}

Hope it will help someone. [1]: https://developer.android.com/reference/android/content/pm/PackageManager.html#canRequestPackageInstalls()

Solution 18 - Android

If you are facing this issue in device using android 12. You can fix it by adding android:exported="true" in AndroidManifest.xml as mentioned below

<activity
            android:name=".MainActivity"
            android:exported="true"
            android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
            android:label="@string/app_name"

Solution 19 - Android

For anyone else having this issue the only time i ever got this error was when the API version in your Android Build configuration does not match what's on the physical device.

Go into Eclipse and right click on your project and go to properties. Select Android--WHICH BRINGS YOU TO ANDROID BUILD TARGET. Adjust you target to match the device and see if that resolves the issue.

Solution 20 - Android

I had this problem, even when I specified the correct minSDK and targetSDK version. My problem was, I was using "android:theme="@android:style/Theme.NoTitleBar.Fullscreen" in launcher activity, on Jellybean device. When I removed this attribute, it worked.

Solution 21 - Android

As a couple of the other answers have mentioned, there can be problems when installing from the SD card. In my case I was distributing my app via email attachment, and it usually worked fine. Just open the email and download the attachment (it apparently goes to the SD card) and click on it again and it gets installed.

But then one day it didn't work, and it turned out it was because I had the phone connected to my development PC via USB, and that placed the SD card in a different mode or something. So the solution was simply to disconnect the phone from the PC and then send the e-mail again and download the attachment again. Or else place the USB connection in "charging only" mode so the SD card is not "connected" to the PC.

Solution 22 - Android

You might also want to check the logs on the device to see if it's something simple like a permissions problem. You can check the logs using adb from a host/debug computer:

adb logcat

Or if you have access to the console (or when using Android-x86 get console by typing Alt+F1) then you can check the logs by using the logcat command:

logcat

Solution 23 - Android

I had the same problem using the apk file exported from android‌ Tools > Export. I used the apk file in bin folder instead and it worked!

P.S. apk file in bin folder is created after first time you run the application in eclipse.

Solution 24 - Android

use it inside build.gradle (Module:app)

minSdkVersion 14
targetSdkVersion 28

This error also comes when Android version is less than minSdkVersion

Solution 25 - Android

In my case I signed with only V2 signature (from Android 7 onward) but tried to install on 5 and 6. Adding V1 during ARK generation/signing fixed the issue.

See https://stackoverflow.com/questions/42648499/difference-between-signature-versions-v1-jar-signature-and-v2-full-apk-sign.

Solution 26 - Android

In my case build 1 was installed correctly in my mobile using the signed APK (also from Google Play Store). But when I update the application with build 2 for first time, I had an issue installing it with the signed APK as I got "There was a problem parsing the package".

I tried several methods as specified above. But did not work.

After some time, I rerun the commands

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-key.keystore app-release-unsigned.apk myappkeyalias
zipalign -v 4 app-release-unsigned.apk MyApp.apk

and surprisingly, it worked.

It seems sometimes the APK built might be corrupt. So, Re-running jarsigner and zipalign commands resolved my issue.

Solution 27 - Android

In my case i written <activity android:".Stopwatch"/> instead of <activity android:name=".Stopwatch"/> in android manifest.

Check your manifest and gradle file again.

Solution 28 - Android

I am experiencing the same “Parse error: There is a problem parsing the package “ error message with my signed APKs as others but I suspect it could be caused by different reasons.

To test this I did the following:

Setup Windows 8.1 Eclipse ADT Build: v22.6.2-1085508

I generated a typical new Helloworld app accepting all defaults.

I ran the app on an emulator and live device successfully.

I then sideloaded and installed the apk to my live device and ran it successfully.

It had generated an apk in the bin folder with a size of 782 KB.

I then exported the Helloworld app to the same bin folder signing the app from my key store which has been used successfully in the past to promote to Google Play.

It created an APK with a size of 385 KB (replacing the original apk).

I sideloaded the apk to my device and when I went to install it I got the error “Parse error: There is a problem parsing the package” (this is the same package that sideloaded and installed when done as a non exported form).

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRaghuView Question on Stackoverflow
Solution 1 - Androiduser175750View Answer on Stackoverflow
Solution 2 - AndroidjmuView Answer on Stackoverflow
Solution 3 - AndroidSir ScalawagView Answer on Stackoverflow
Solution 4 - AndroidVeneet ReddyView Answer on Stackoverflow
Solution 5 - AndroidShivendraView Answer on Stackoverflow
Solution 6 - AndroidMikeView Answer on Stackoverflow
Solution 7 - AndroidMohammed Irfan TirupatturView Answer on Stackoverflow
Solution 8 - AndroidJeffNhanView Answer on Stackoverflow
Solution 9 - AndroidMojAmiriView Answer on Stackoverflow
Solution 10 - AndroidkansasianView Answer on Stackoverflow
Solution 11 - AndroidMortenSickelView Answer on Stackoverflow
Solution 12 - AndroidWilliam T. MallardView Answer on Stackoverflow
Solution 13 - AndroidSiddharthView Answer on Stackoverflow
Solution 14 - AndroidAbhishekView Answer on Stackoverflow
Solution 15 - AndroidHonzaView Answer on Stackoverflow
Solution 16 - AndroidMuhammadView Answer on Stackoverflow
Solution 17 - AndroidRaselView Answer on Stackoverflow
Solution 18 - AndroidAnupam ChaplotView Answer on Stackoverflow
Solution 19 - Androidj2emanueView Answer on Stackoverflow
Solution 20 - Androiduser1035292View Answer on Stackoverflow
Solution 21 - AndroidRenniePetView Answer on Stackoverflow
Solution 22 - AndroidPierzView Answer on Stackoverflow
Solution 23 - AndroidAli SheikhpourView Answer on Stackoverflow
Solution 24 - AndroidSHUBHASIS MAHATAView Answer on Stackoverflow
Solution 25 - AndroidAlexei MartianovView Answer on Stackoverflow
Solution 26 - AndroidNaveen Kumar VView Answer on Stackoverflow
Solution 27 - AndroidDharmesh KaleView Answer on Stackoverflow
Solution 28 - AndroidWilliam BellView Answer on Stackoverflow