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

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?

This question is related to android

The answer is


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

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.


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.


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).


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


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...


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

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

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 Difference between signature versions - V1 (Jar Signature) and V2 (Full APK Signature) while generating a signed APK in Android Studio?.


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.


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.


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.


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.


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.


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


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 () 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.


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.


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.


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.


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

Check your manifest and gradle file again.


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");

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.


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.


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.


use it inside build.gradle (Module:app)

minSdkVersion 14
targetSdkVersion 28

This error also comes when Android version is less than minSdkVersion


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.