microsoft / appcenter

Central repository for App Center open source resources and planning.
https://appcenter.ms
Creative Commons Attribution 4.0 International
1.01k stars 223 forks source link

Support for Xamarin.Android 13.2.2.0 so that we can target Android API 34 #2611

Open dinisvieira-xo opened 9 months ago

dinisvieira-xo commented 9 months ago

Describe the solution you'd like Support for Xamarin.Android 13.2.2.0 so that we can target Android API 34. Xamarin.Android 13.2.2.0 Release notes

Describe alternatives you've considered Migration to MAUI (which is not an option for us in the next few months) or using another build service.

Additional context This is needed if we want to publish to the Google Play Store after August 2024

Banana14 commented 9 months ago

I have the same request. Long story: I updated our xamarin forms android project to target android sdk version 34. This was building locally but had issues with deployment (something about apk not being a zip, very puzzling). Until I realized that the I needed to update visual studio 22 to at least version 17.8. Then it built / deployed fine locally. I tried the same on appcenter, but then I get the following error:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Aapt2.targets(189,3): error APT2000: Write fault on path /Users/runner/work/1/s/FolderName/AppName/AppName.Android/[Unknown] "[Unknown]". [/Users/runner/work/1/s/FolderName/AppName/AppName.Android/AppName.Android.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Aapt2.targets(189,3): error APT2000: Write fault on path /Users/runner/work/1/s/FolderName/AppName/AppName.Android/[Unknown] "[Unknown]". [/Users/runner/work/1/s/FolderName/AppName/AppName.Android/AppName.Android.csproj]
Done Building Project "/Users/runner/work/1/s/FolderName/AppName/AppName.Android/AppName.Android.csproj" (PackageForAndroid target(s)) -- FAILED.

Since AppCenter is usually some time behind the latest visual studio features, I'm guessing the error is because SDK 34 is not supported yet.

Note: we're in the same predicament, migration to MAUI is not an option for us in the coming months...

scherici commented 8 months ago

Same issue by my side, seems that app center does not support yet the "new" xamarin sdk version. The latest supported version is 13.2.1.2, but we need 13.2.2.0 as well if we want to re-use our old scripts/build process....

adamtha commented 8 months ago

i had to fallback to Android 13 (API level 33) for now and its building fine targeting API 34 failing with the same issues listed above

though the build vm image used seems to have SDK 34 insalled https://github.com/actions/runner-images/blob/main/images/macos/macos-11-Readme.md

follesoe commented 8 months ago

As a bare minimum, Microsoft should ensure AppCenter stays alive and supports the last Xamarin releases, preventing developers from having to waste time on yet a migration (from AppCenter to another build service), and rather can focus on migrating from Xamarin to MAUI.

follesoe commented 8 months ago

A workaround is to install Xamarin.Android 13.2.2.0 yourself in a pre-build script:

#!/usr/bin/env bash
PKG_URL="https://dl.xamarin.com/MonoforAndroid/Mac/xamarin.android-13.2.2.0.pkg"
PKG_NAME=${PKG_URL##*/}
curl -4fsLo "${PKG_NAME}" "${PKG_URL}"
sudo installer -pkg "${PKG_NAME}" -target /
Cybrosys commented 5 months ago

Using the above hint, I got it working for Azure Build pipelines, but I had to add some more:

# Install the latest Android SDK Command-Line Tools and SDK 34
- script: |
    echo "Installing Android Command-Line Tools"
    mkdir -p $ANDROID_HOME/cmdline-tools/latest
    cd $ANDROID_HOME/cmdline-tools/latest
    curl -o sdk-tools.zip https://dl.google.com/android/repository/commandlinetools-mac-7583922_latest.zip
    unzip sdk-tools.zip
    export PATH=$ANDROID_HOME/cmdline-tools/latest/bin:$PATH
    yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses
    $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --update
    $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "platform-tools" "platforms;android-34" "build-tools;34.0.0"
  displayName: 'Install Android SDK Command-Line Tools and SDK 34'

# Install the latest Xamarin.Android package
- script: |
    echo "Installing Xamarin.Android"
    PKG_URL="https://dl.xamarin.com/MonoforAndroid/Mac/xamarin.android-13.2.2.0.pkg"
    PKG_NAME=${PKG_URL##*/}
    curl -4fsLo "${PKG_NAME}" "${PKG_URL}"
    sudo installer -pkg "${PKG_NAME}" -target /
  displayName: 'Install Xamarin.Android'

# Ensure the environment is updated with the latest tools
- script: |
    echo "Setting up environment variables"
    export PATH=$ANDROID_HOME/platform-tools:$PATH
    export PATH=$ANDROID_HOME/build-tools/34.0.0:$PATH
  displayName: 'Set up environment variables'
medziane commented 2 months ago

Using the above hint, I got it working for Azure Build pipelines, but I had to add some more:

# Install the latest Android SDK Command-Line Tools and SDK 34
- script: |
    echo "Installing Android Command-Line Tools"
    mkdir -p $ANDROID_HOME/cmdline-tools/latest
    cd $ANDROID_HOME/cmdline-tools/latest
    curl -o sdk-tools.zip https://dl.google.com/android/repository/commandlinetools-mac-7583922_latest.zip
    unzip sdk-tools.zip
    export PATH=$ANDROID_HOME/cmdline-tools/latest/bin:$PATH
    yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses
    $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --update
    $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "platform-tools" "platforms;android-34" "build-tools;34.0.0"
  displayName: 'Install Android SDK Command-Line Tools and SDK 34'

# Install the latest Xamarin.Android package
- script: |
    echo "Installing Xamarin.Android"
    PKG_URL="https://dl.xamarin.com/MonoforAndroid/Mac/xamarin.android-13.2.2.0.pkg"
    PKG_NAME=${PKG_URL##*/}
    curl -4fsLo "${PKG_NAME}" "${PKG_URL}"
    sudo installer -pkg "${PKG_NAME}" -target /
  displayName: 'Install Xamarin.Android'

# Ensure the environment is updated with the latest tools
- script: |
    echo "Setting up environment variables"
    export PATH=$ANDROID_HOME/platform-tools:$PATH
    export PATH=$ANDROID_HOME/build-tools/34.0.0:$PATH
  displayName: 'Set up environment variables'

This worked for me. Thanks @Cybrosys & @follesoe