xamarin Visual Studio 2015 apk fails to install: Error “parsing the package”

耗尽温柔 提交于 2020-01-05 08:03:27

问题


Wrote app for an android device whose installed Android version is Lollipop 5.1 (AZPEN A1040 tablet - latest version available for it).

The app installs and works correctly in the emulator (setup to emulate a Lollipop 5.1 device)

However, after archiving without any issues, when attempting to install the app's apk file to the actual target device, I get the following error:

"There was a problem parsing the package"

The project's properties in Visual Studio 2015 are displayed in the graphics below:

All the referenced libraries in the project are shown in the picture below:

I have neither errors nor warnings during the build, deploy to emulator or archiving processes.

The target device has already the following settings enabled:

  • "Allow installation of apps from unknown sources"
  • "USB Debugging" (installation has been attempted with this setting on or off without success)

EDIT: To add pertinent info based on comments below

  • The apk is signed (previously archived apks have worked correctly. New code has been added since those working apks, but as mentioned I have no errors or warning when building the latest apk).
  • Have not tried archiving in Debug mode (not sure if it will let me, not sure I'd like to try since this is for a client).
  • The apks are named during archiving process. After the creation, apk file's name has not been changed(I did change the 'suggested' name to something shorter during the archiving process, but did it so also for the previously working apk vesions whose installation worked on the target device).

At this point I'm at a loss as to what to do to make this install on the target device.

Any ideas?


回答1:


I was receiving this issue and the problem was because I had multiple versions of the "Android SDK Build Tools" installed.

To see if you have this, go to the Android SDK Manager, and look under Tools.

If you have multiples, uninstall all the extra ones and rebuild your package.

As soon as I did this, I was able to deploy/install this package w/out hassle.

Note that the package that wouldn't install on the device WOULD install in the emulator(I'm using Visual Studio Emulator for Android).




回答2:


Figured it out what the issue was. The settings on the device under "About Tablet" displayed the Android Version as 5.1. Because of that, I set the Minimum Android Target in the Visual Studio project as "Android 5.1 (API Level 22 - Lollipop)".

After reading @Jon_Douglas' comment, I decided to bite the bullet and ask the client to let me use his device for troubleshooting. Once I connected the device, Visual Studio picked it up as "AZPEN A1040 (Android 5.0 - API 21)".

I changed the Minimum Android Target to "Android 5.0 (API Level 21 - Lollipop)" and was able to install the apk. Compare the settings image below to the one initially provided above:



来源:https://stackoverflow.com/questions/42756947/xamarin-visual-studio-2015-apk-fails-to-install-error-parsing-the-package

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!