安装 Android 应用程序时出现“解析错误:解析包时出现问题”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1492401/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 03:08:28  来源:igfitidea点击:

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

android

提问by Raghu

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

我在安装 android 应用程序 ( Parse Error : There is a problem parsing the package.)时遇到此错误。我做了以下步骤。

  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.

  1. 我第一次安装该应用程序,它工作正常。

  2. 我对现有应用程序进行了更改,并更改了清单文件中的版本号。

    <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.openintents.samples.BasicOpenARDemo" android:versionCode="2" android:versionName="1.0.1">
    
  3. 然后我导出应用程序并完成代码签名过程。为此,右键单击您的项目节点 > 选择导出。在那里你会看到一个向导。按照步骤并完成代码签名。

  4. 我得到了 ARDemo.apk 文件,然后我把它的名字改成了 ARDemo1.apk

  5. 然后我将此 apk 文件发送到手机 SD 卡并开始安装,但出现上述错误。

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

我用谷歌搜索,他们说解压清单文件有问题。

Can anyone tell me what could be wrong with me?

谁能告诉我我有什么问题?

采纳答案by user175750

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
  1. 版本号(我假设这没有参与破坏任何东西)
  2. 编码
  3. .apk 文件的名称

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.

尝试将 ARDemo1.apk 文件重命名回 ARDemo.apk(确保备份旧版本),看看是否有帮助。我的猜测是它与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.

如果它仍然不起作用,那么您可以消除作为问题根源的 apk 文件的名称并开始调查 2) 通过重建您的旧版本,看看您是否再次遇到同样的问题。如果旧代码的重建版本不存在问题,那么您知道它一定与您的代码有关。

I hope that gets you somewhere.

我希望能带你到某个地方。

Cheers, Joseph

干杯,约瑟夫

回答by jmu

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
  • 签名后更改包的名称:使用签名包的确切名称(而是在清单中调整名称)
  • 包是针对更高的 API 级别编译的:更正清单文件中的 API 级别
  • 包从 SD 卡执行:运行(安装)手机内存中的 apk 文件或使用 adb 命令安装它

回答by Sir Scalawag

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.

当设备上的 android 版本低于编译应用程序的版本时,我只看到解析错误。例如,如果应用程序是为 android OS v2.2 编译的,而您的设备只有 android OS v2.1,当您尝试安装该应用程序时,您会收到解析错误。

回答by Shivendra

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

原因是 apk 没有签名。签署apk后,问题将得到解决。 http://ionicframework.com/docs/guide/publishing.html请使用说明上的链接来签署 apk。

回答by Veneet Reddy

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

不是在黑暗中拍摄,而是通过以下方式安装它来获取此错误的原因adb

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

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

替换emulator-5555为您的设备名称。您可以使用以下方法获取列表:

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
  1. INSTALL_PARSE_FAILED_NO_CERTIFICATES:参考
  2. INSTALL_FAILED_UPDATE_INCOMPATIBLE:参考

回答by Mohammed Irfan Tirupattur

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

检查您的设备是否支持您在 AndroidManifest.xml中的minSdkVersion中指定的版本。如果没有指定低版本再试

回答by Mike

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.

如果您在 SDK 版本 2.1 下编译和导出您的 apk 文件,它将无法在您的 SDK 导出“2.1”以下的任何 android 版本上运行。Android 软件向前兼容不向后兼容。例如,如果您正在使用允许在 C/C++ 家族中进行开发的 android NDK(android SDK 的附加组件)包进行编程,则这仅与 android 2.3 兼容,android 2.2 及以下版本仅支持 java 构建。因此,您将收到“解析包时出现问题”错误。

回答by MojAmiri

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.

另一种可能性是您已将 apk 文件保存到 application PRIVATE 文件夹中,然后尝试安装(通过从您的代码启动一个意图)。在这种情况下,当您启动 Intent 时,您会收到错误解析包。在这种情况下,引发的错误与权限问题有关。关键是将文件保存到私人文件夹中不是一个好习惯,但是如果你真的想这样做,你应该在下载文件时将文件写入 MODE_WORL_READABLE 中。请考虑 MODE_WORLD_READABLE 已弃用,此解决方案不是最好的,因为它存在一些安全问题。最好是将文件保存在外部存储中。

回答by JeffNhan

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

我不重复这里指示输入密钥库、密码等的内容。尝试

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

Build -> Generate Signed APK -> [ Input ] ---Next---> 选择BOTH

  • V1 (Jar Signature)
  • V2 (Full APK Signature)
  • V1 (Jar 签名)
  • V2(完整的 APK 签名)

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

我不知道为什么,但至少它在我的情况下有效。

回答by kansasian

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:

我在尝试从电子邮件安装 .apk 包时遇到了同样的错误(解析错误,解析包时出现问题)。我能够通过安装 3rd 方软件包安装程序 ApKatcher 来解决这个问题:

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

http://www.additivetips.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.

ApKatcher 不是唯一的解决方案。我的一位同事通过安装 Astro 文件管理器解决了这个问题。

You can find both applications in the Android Marketplace.

您可以在 Android Marketplace 中找到这两个应用程序。