1
votes

Description

I have a project that runs fine on my Nokia android device. To update its reach, I updated my device to android 10. I went to the SDK manager and got the android v29.

With my AMD PC, a debug only using real devices.

I changed the target framework to v29, Android 10-Q.

I am getting deployment issues

Steps to Reproduce

  1. Create a Xamarin. Forms project that targets Android 9.
  2. Update framework and Nugget package to update
  3. Run

Expected Behavior

Build and deploy successfully

Actual Behavior

Gives the error

Severity    Code    Description Project File    Line    Suppression State
Error       ADB0010:  Deployment failed
Mono.AndroidTools.InstallFailedException: Unexpected install output: Error: Failed to parse APK file: /data/local/tmp/Mono.Android.Platform.ApiLevel_29.apk
Exception occurred while executing:
java.lang.IllegalArgumentException: Error: Failed to parse APK file: /data/local/tmp/Mono.Android.Platform.ApiLevel_29.apk
    at com.android.server.pm.PackageManagerShellCommand.setParamsSize(PackageManagerShellCommand.java:486)
    at com.android.server.pm.PackageManagerShellCommand.runInstall(PackageManagerShellCommand.java:1075)
    at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:169)
    at android.os.ShellCommand.exec(ShellCommand.java:104)
    at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:22021)
    at android.os.Binder.shellCommand(Binder.java:881)
    at android.os.Binder.onTransact(Binder.java:765)
    at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:4876)
    at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:4128)
    at android.os.Binder.execTransactInternal(Binder.java:1021)
    at android.os.Binder.execTransact(Binder.java:994)
Caused by: android.content.pm.PackageParser$PackageParserException: Failed to parse /data/local/tmp/Mono.Android.Platform.ApiLevel_29.apk
    at android.content.pm.PackageParser.parseApkLiteInner(PackageParser.java:1597)
    at android.content.pm.PackageParser.parseApkLite(PackageParser.java:1582)
    at com.android.server.pm.PackageManagerShellCommand.setParamsSize(PackageManagerShellCommand.java:479)
    ... 10 more
at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName) in E:\A\_work\548\s\External\androidtools\Mono.AndroidTools\Internal\AdbOutputParsing.cs:line 345
   at Mono.AndroidTools.AndroidDevice.<>c__DisplayClass95_0.<InstallPackage>b__0(Task`1 t) in E:\A\_work\548\s\External\androidtools\Mono.AndroidTools\AndroidDevice.cs:line 753
   at System.Threading.Tasks.ContinuationTaskFromResultTask`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at AndroidDeviceExtensions.<PushAndInstallPackage>d__11.MoveNext() in E:\A\_work\548\s\External\androidtools\Xamarin.AndroidTools\Devices\AndroidDeviceExtensions.cs:line 187
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at AndroidDeviceExtensions.<PushAndInstallPackage>d__11.MoveNext() in E:\A\_work\548\s\External\androidtools\Xamarin.AndroidTools\Devices\AndroidDeviceExtensions.cs:line 203
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at AndroidDeviceExtensions.<InstallSharedPlatformAsync>d__24.MoveNext() in E:\A\_work\548\s\External\androidtools\Xamarin.AndroidTools\Devices\AndroidDeviceExtensions.cs:line 478
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Xamarin.AndroidTools.AndroidDeploySession.<InstallSharedPlatformAsync>d__110.MoveNext() in E:\A\_work\548\s\External\androidtools\Xamarin.AndroidTools\Sessions\AndroidDeploySession.cs:line 355
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Xamarin.AndroidTools.AndroidDeploySession.<EnsureCorrectSharedRuntimes>d__107.MoveNext() in E:\A\_work\548\s\External\androidtools\Xamarin.AndroidTools\Sessions\AndroidDeploySession.cs:line 266
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Xamarin.AndroidTools.AndroidDeploySession.<RunAsync>d__106.MoveNext() in E:\A\_work\548\s\External\androidtools\Xamarin.AndroidTools\Sessions\AndroidDeploySession.cs:line 194
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Xamarin.AndroidTools.AndroidDeploySession.<RunLoggedAsync>d__104.MoveNext() in E:\A\_work\548\s\External\androidtools\Xamarin.AndroidTools\Sessions\AndroidDeploySession.cs:line 119          0   

Basic Information

  • Version with issue: Xamarin.forms 4.6.0.772 android 10
  • Last known good version: Xamarin.forms 4.6.0.772 android 9
  • IDE: Visual studio 2019 v16.5.4
  • Platform Target Frameworks: Android 10 (Q)
    • iOS: 8.0 (not the issue)
    • Android: 10.0
    • UWP: Windows 10 1903 18362 (not the issue)
  • Android Support Library Version:
  • Nuget Packages:
  • Affected Devices:

Screenshots

Image of error

Reproduction Link

Public git of error

Workaround

Still stuck (15-04-2020 14:11 GMT +1)

1
Did you change compile version to 10 and updated all Nugets?Morse
Yes, I did, I updated it to the latest version I could find.Rikudou En Sof
I wasnt able to reproduce but android:targetSdkVersion="28" it has to be 29Morse
Ok. Even at 29, still same problemzRikudou En Sof
I am having the same issue (stackoverflow.com/questions/61382744/…). Did you find a way to fix it?Luigitni

1 Answers

0
votes

Found the solution to the problem. A good fella helped me resolve it.

https://github.com/xamarin/Xamarin.Forms/issues/10707#issuecomment-630271548

I had to delete the all files generated at %localappdata%. In my windows.

Check out the link to see exact details