I'm trying to build a MAUI app for Android, to be debugged on a locally attached tablet. I'm trying to store the location of the keystore in the textbox of the project, but VS2022 refuses to accept the string. I have now added it manually into the csproj, but it still doesn't show, and it isn't signing.
This is a portion of my CSPROJ file:
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net9.0-android35.0|AnyCPU'">
<AndroidKeyStore>True</AndroidKeyStore>
<AndroidSigningKeyStore>c:\clients\android.keystore</AndroidSigningKeyStore>
<AndroidSigningStorePass>thePassword</AndroidSigningStorePass>
<AndroidSigningKeyAlias>android</AndroidSigningKeyAlias>
<AndroidSigningKeyPass>android</AndroidSigningKeyPass>
<AndroidApkSignerAdditionalArguments></AndroidApkSignerAdditionalArguments>
</PropertyGroup>
This is the error output I get:
1>Deployment failed to Acer B3-A40.
1>Deploy failed
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
========== Deploy completed at 11:47 and took 05.605 seconds ==========
LastWriteTime of `C:\Users\eric\source\repos\MauiApp3\MauiApp3\bin\Debug\net9.0-android35.0\com.companyname.mauiapp3-Signed.apk`: 2025-04-09 15:45:25
DEBUG RunShellCommand 719014592815 pm install -d "/data/local/tmp/com.companyname.mauiapp3-Signed.apk" [1837ms]
DEBUG RunShellCommand 719014592815 rm "/data/local/tmp/com.companyname.mauiapp3-Signed.apk" [1657ms]
FastDeploy
target.prop.ro.product.build.version.sdk: 24
target.prop.ro.product.cpu.abilist: arm64-v8a;armeabi-v7a;armeabi
target.prop.ro.product.manufacturer: Acer
target.prop.ro.product.model: B3-A40
target.prop.ro.product.cpu.abi: arm64-v8a
deploy.error.code: ADB0010
deploy.tool: xamarin.sync
deploy.result: Failed
deploy.supports.fastdev: True
deploy.systemapp: False
deploy.duration.ms: 0
pii.deploy.error: Mono.AndroidTools.InstallFailedException: The package was not properly signed (NO_CERTIFICATES).
at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName) in /Users/runner/work/1/s/xamarin-android/external/android-platform-support/src/Mono.AndroidTools/Internal/AdbOutputParsing.cs:line 315
at System.Threading.Tasks.Task.Execute()
I built the keystore with the following commands in administrator DOS box:
cd "c:\program files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08\jre\bin\"
keytool -genkey -v -keystore c:\clients\android.keystore -storepass thePassword -alias android -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "cn=MyName, ou=MyGroup, o=MyCompany, c=Canada" -storetype pkcs12
keytool -genkey -v -keystore c:\clients\android.keystore -storepass thePassword -alias other -keypass other!5 -keyalg RSA -keysize 2048 -validity 10000 -dname "cn=MyName, ou=MyGroup, o=MyCompany, c=Canada" -storetype pkcs12
My VS2022 is up-to-date (v17.13.6). What's the secret to getting it to sign the app?
You tried to set different passwords for:
the keystore itself (-storepass
)
and the private key inside it (-keypass
)
But in PKCS12 format, they must be the same.
So the tool (likely keytool
) just ignored your -keypass
and used -storepass
for both.
You can use the same passwords for both hope this will work,
keytool -genkeypair \
-alias mykey \
-keyalg RSA \
-keystore mykeystore.p12 \
-storetype PKCS12 \
-storepass secret123 \
-keypass secret123 # same as storepass