MAUIAppVersion icon indicating copy to clipboard operation
MAUIAppVersion copied to clipboard

Version number replacing android sdk target version

Open reidsmiller opened this issue 3 months ago • 0 comments

I was able to publish without issue last week, and without making any changes in github actions, my csproj, or AndroidManifest.xml my MAUI app when publishing to google play returns this error: Error: Target SDK of artifact is too low: <my current application version number (ex: 518)>. The version number is replacing my android <uses-sdk>35</uses-sdk> on the build prior to upload. I'm not sure when this is happening in the ci process.

With printFile=true on the managedCode step the csproj appears correct, so it seems possible that the bug is occurring on MSBuild, but regardless MAUIAppVersion is not working for my android builds and I am uploading manually until I can find a workaround. Building locally through Visual Studio with manually input versioning works fine.

Here is my current .yml just in case there is something I'm missing. I am building with .net 8.0.302:

jobs:
  publish-android:
    runs-on: windows-latest

    steps:
      - name: Checkout Repository
        uses: actions/checkout@v4

      - name: Setup .NET ${{ inputs.dotnet-version }}
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: ${{ inputs.dotnet-version }}

      - name: Install MAUI Workloads
        run: dotnet workload install android maui

      - name: Restore NuGet Packages
        run: dotnet restore ${{ inputs.sln-file }} --configfile ${{ inputs.nuget-config }}
        env:
          TELERIK_NUGET_KEY: ${{ secrets.telerik-nuget-api-key }}

      - name: Decode Keystore
        id: decode_keystore
        uses: timheuer/base64-to-file@v1
        with:
          fileDir: '${{ github.workspace }}\${{ inputs.project-folder }}'
          fileName: 'app-upload-android.keystore'
          encodedString: ${{ secrets.keystore-base64 }}

      - name: Version the app
        uses: managedcode/MAUIAppVersion@v1
        with:
          csproj: ${{ inputs.project-file }}
          version: ${{ github.run_number }}
          displayVersion: ${{ inputs.build-version }}.${{ github.run_number }}
          printFile: true

      - name: Publish .NET MAUI Android APK
        env:
          TELERIK_LICENSE: ${{ secrets.telerik-license }}
        run: |
          dotnet publish ${{ inputs.project-file }} -c ${{ inputs.build-config }} `
          -f ${{ inputs.dotnet-version-target}}-android `
          -p:AndroidPackageFormat=aab `
          -p:AndroidKeyStore=true `
          -p:AndroidSigningKeyStore="${{ github.workspace }}/${{ inputs.project-folder }}/tw-upload-android.keystore" `
          -p:AndroidSigningKeyAlias=${{ secrets.keystore-alias }} `
          -p:AndroidSigningKeyPass=${{ secrets.keystore-password }} `
          -p:AndroidSigningStorePass=${{ secrets.keystore-password }} `
          --no-restore

      - name: Upload APK to Google Play
        uses: r0adkll/upload-google-play@v1
        id: play_upload
        with:
          serviceAccountJsonPlainText: ${{ secrets.playstore-service-account }}
          packageName: ${{ inputs.package-name }}
          releaseFiles: ${{ inputs.project-folder }}/bin/${{ inputs.build-config }}/${{ inputs.dotnet-version-target }}-android/${{ inputs.package-name }}-Signed.aab
          inAppUpdatePriority: 1
          track: internal

reidsmiller avatar Sep 04 '25 23:09 reidsmiller