Summary:
I'm attempting to build and sign a .NET MAUI Android app using GitHub Actions. While everything works perfectly on my local machine, and the GitHub Actions workflow runs smoothly up until the signing stage, I encounter an error related to jarsigner.exe during the build process on GitHub Actions.
The problem:
Error message
C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.68\tools\Xamarin.Android.Common.targets(2335,2): error MSB6006: "jarsigner.exe" exited with code 1. [D:\a\App.name\App.name\App.name\App.name.csproj::TargetFramework=net7.0-android]
Last part of the workflow
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'microsoft'
java-version: '17'
- name: Build
run: dotnet build App.name/App.name.csproj -c Release -f net7.0-android /p:AndroidSigningKeyPass=${{ secrets.KEYSTORE_PASSWORD }} /p:AndroidSigningStorePass=${{ secrets.KEYSTORE_PASSWORD_STORE }} --no-restore
Additional Information:
- The keystore file is correctly decrypted and available in the GitHub secrets
- Actions environment. The Java version being used is 17 from the
- Microsoft distribution. All preceding steps in the workflow, including dependency restoration and MAUI workload installation, complete without issues. Has anyone encountered a similar issue or can provide insights into what might be causing this error with jarsigner.exe on GitHub Actions?
Should I perhaps share the the entire .yaml file?
Ok, so I solved it.
Removing the keystore config in the .csproj file and adding them to the command made it worked.
Edit:
Had to remove
/p:AndroidKeyStore=truefor it to not throw errors.Edit 2: Actually I added
/p:AndroidKeyStore=trueback. The real problem was in wich environment I was running thegpgcommand for the keystore.