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:
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.
run: dotnet build App.name/App.name.csproj -c Release -f net7.0-android /p:AndroidKeyStore=true /p:AndroidSigningKeyStore=${{secrets.KEYSTORE}} /p:AndroidSigningKeyAlias=${{ secrets.KEYSTORE_ALIAS }} /p:AndroidSigningKeyPass=${{ secrets.KEYSTORE_PASSWORD }} /p:AndroidSigningStorePass=${{ secrets.KEYSTORE_PASSWORD }}
--no-restore
Edit:
Had to remove /p:AndroidKeyStore=true
for it to not throw errors.
Edit 2: Actually I added /p:AndroidKeyStore=true
back. The real problem was in wich environment I was running the gpg
command for the keystore.