Home > Software design >  Keep getting error "java.exe" exited with code 2 / The package was not properly signed (NO
Keep getting error "java.exe" exited with code 2 / The package was not properly signed (NO

Time:04-27

I created an empty Xamarin.Forms project on Visual Studio 2019 for Android and IOS and without adding any code and this error popped up without letting me build the project.

MSB6006: "java.exe" exited with code 2.

I have looked into this and I've tried

  • Deleting bin and obj file from Xamarin.Android and rebuild
  • Repairing Visual Studio
  • Untick the sign Apk option on Android properties
  • Checking Multi-Dex on Android properties
  • Uninstalling and installing Visual Studio 2019 again
  • Changing the sdk file path like so android-sdk path containing "space"

And I have looked into this solutions but none of them work for me

Please help because I don't know what is causing this and I have tried everything.

EDIT: After a couple of times trying to build the project this is the error that shows up:

Mono.AndroidTools.InstallFailedException: The package was not properly signed (NO_CERTIFICATES).
   en Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName) en D:\a\_work\1\s\External\androidtools\Mono.AndroidTools\Internal\AdbOutputParsing.cs:línea 338
   en Mono.AndroidTools.AndroidDevice.<>c__DisplayClass100_0.<InstallPackage>b__0(Task`1 t) en D:\a\_work\1\s\External\androidtools\Mono.AndroidTools\AndroidDevice.cs:línea 803
   en System.Threading.Tasks.ContinuationTaskFromResultTask`1.InnerInvoke()
   en System.Threading.Tasks.Task.Execute()
--- Fin del seguimiento de la pila de la ubicación anterior donde se produjo la excepción ---
   en System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   en System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   en AndroidDeviceExtensions.<PushAndInstallPackageAsync>d__12.MoveNext() en D:\a\_work\1\s\External\androidtools\Xamarin.AndroidTools\Devices\AndroidDeviceExtensions.cs:línea 206
--- Fin del seguimiento de la pila de la ubicación anterior donde se produjo la excepción ---
   en System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   en AndroidDeviceExtensions.<PushAndInstallPackageAsync>d__12.MoveNext() en D:\a\_work\1\s\External\androidtools\Xamarin.AndroidTools\Devices\AndroidDeviceExtensions.cs:línea 223
--- Fin del seguimiento de la pila de la ubicación anterior donde se produjo la excepción ---
   en System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   en System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   en Xamarin.Android.Tasks.FastDeploy.<InstallPackage>d__101.MoveNext() en /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:línea 338
--- Fin del seguimiento de la pila de la ubicación anterior donde se produjo la excepción ---
   en System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   en Xamarin.Android.Tasks.FastDeploy.<InstallPackage>d__101.MoveNext() en /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:línea 355
--- Fin del seguimiento de la pila de la ubicación anterior donde se produjo la excepción ---
   en System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   en System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   en System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   en Xamarin.Android.Tasks.FastDeploy.<RunTaskAsync>d__96.MoveNext() en /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:línea 212           0   Compilación 

CodePudding user response:

For me what worked was just deleting the following:

  • Android folder which contains the sdk C:\Program Files (x86)\Android
  • Eclipse Foundation folder which contains the jdk
  • Xamarin folder C:\Users\USER\AppData\Local\Xamarin

And then reinstall Visual Studio 2019.

Before it wouldn't let me build any Xamarin project even though I had tried everything people said when referring to this error.

I hope this helped someone in case of having the same issue as me.

  • Related