“Parse Error : There is a problem parsing the pack

2019-01-01 00:41发布

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
22条回答
忆尘夕之涩
2楼-- · 2019-01-01 01:23

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.

查看更多
时光乱了年华
3楼-- · 2019-01-01 01:23

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");
查看更多
时光乱了年华
4楼-- · 2019-01-01 01:25

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.

查看更多
还给你的自由
5楼-- · 2019-01-01 01:26

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
查看更多
刘海飞了
6楼-- · 2019-01-01 01:26

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.

查看更多
明月照影归
7楼-- · 2019-01-01 01:27

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.

查看更多
登录 后发表回答