Mahmoud Alam
Mahmoud Alam

Reputation: 430

The package was not properly signed (NO_CERTIFICATES) in running application

I am developing xamarin forms application and i got the below error when running application on android emulator

>The package was not properly signed (NO_CERTIFICATES).
2>   at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName)
2>   at Mono.AndroidTools.AndroidDevice.<>c__DisplayClass94_0.<InstallPackage>b__0(Task`1 t)
2>   at System.Threading.Tasks.ContinuationTaskFromResultTask`1.InnerInvoke()
2>   at System.Threading.Tasks.Task.Execute()
2>Done building project "Modern.FM.Mobile.Android.csproj".
2>Build succeeded.
2>The package was not properly signed (NO_CERTIFICATES).
2>   at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName)
2>   at Mono.AndroidTools.AndroidDevice.<>c__DisplayClass94_0.<InstallPackage>b__0(Task`1 t)
2>   at System.Threading.Tasks.ContinuationTaskFromResultTask`1.InnerInvoke()
2>   at System.Threading.Tasks.Task.Execute()

Upvotes: 23

Views: 17689

Answers (9)

L.Zoffoli
L.Zoffoli

Reputation: 129

Probably the flag "Sign the .APK file ..." is checked. Go to project properties > Android Package Signing on VisualStudio and decheck this flag. Pay attention to the configuration that is set (Release, Debug, ...)

enter image description here

Upvotes: 0

dpant
dpant

Reputation: 2032

For those trying to work with the following setup:

  • Visual Studio 2019 (version 16.11.28)
  • Xamarin 16.11.000.204
  • Xamarin.Android SDK 12.0.0.3
  • Eclipse Temurin JDK with Hotspot (8u302-b08 (x64))

and having trouble deploying (to the emulator) during debugging due to (one of) the following compile errors:

  • The package was not properly signed (NO_CERTIFICATES)
  • java.exe exited with code 2
  • Failed to load signer "signer #1" - java.io.IOException: Invalid keystore format

the problem is with the (default) C:\Users\%USERNAME%\AppData\Local\Xamarin\Mono for Android\debug.keystore file not working properly with apksigner when targeting Android API Level 30 or greater.

To make ends meet follow the steps below:

  1. In VS > Unload .Android Project > Edit Project File
  2. Add the following line: <AndroidUseApkSigner>true</AndroidUseApkSigner> to the Debug PropertyGroup (as originally mentioned here)
  3. Reload Project
  4. Delete the C:\Users\%USERNAME%\AppData\Local\Xamarin\Mono for Android\debug.keystore file
  5. Clean Solution > Rebuild Solution
  6. Start debugging

Upvotes: 1

Damien Doumer
Damien Doumer

Reputation: 2266

2022 Updated Answer.

For anyone comming accross this issue, if deleting the /bin or /obj didn't work, try these:

  • It might be an issue with branch merging or switching in Git, so what you should do if it is the case is a "git clean -fdx" to clean every residual file.

  • If the above didn't work, open your android "csproj" file, and check that this flag is set to "False" in DEBUG configuration ONLY. <AndroidKeyStore>false</AndroidKeyStore>

Once you do that, it will disable the signing of the debug build, and you'll be able to continue deploying at ease.

Upvotes: 2

Saamer
Saamer

Reputation: 5099

If none of the other solutions work, just open your android project options, and then go to Android Package Signing, and make sure "Sign the .APK file..." is deselected for all the configurations and platforms, as shown: Screenshot of the Android options window

Upvotes: 3

John Deer
John Deer

Reputation: 2358

If deleting /bin folder does not help, try this:

Close Visual Studio.

Open Visual Studio Installer, in drop-down menu select Repair

Upvotes: 1

Gustavo
Gustavo

Reputation: 685

I just delete all file in Folder /bin from my Android project and recompile.

Upvotes: 31

VahidShir
VahidShir

Reputation: 2106

I had the same problem though I got that error once only in emulator and once only in device! I removed my my redundant Java 9 as @jcasas told and also updated my Visual Studio from 15.6.6 to 15.7.0 .

Upvotes: 0

jcasas
jcasas

Reputation: 325

I had the same error but for me just repairing Visual Studio didn't work so I investigated a little bit more and I found out that the problem was related to the java version.

The solution was to uninstall the jre/jdk for java version 9 and now I can deploy again.

Upvotes: 1

Mahmoud Alam
Mahmoud Alam

Reputation: 430

This problem happened after installing visual studio 2017 updates. after running visual studio repair everything worked fine.

Upvotes: 1

Related Questions