Xamarin support for Android API 34 (14)

Yohanes AI 0 Reputation points
2024-10-28T11:21:17.2066667+00:00

Hi

I have a project and trying to update to API 34 with no luck even I create a blank project (Start new project with basic hello world template) also giving me the same error.

Here is the error

The TargetFrameworkVersion (Android API level 33) is lower than the targetSdkVersion (34). Please increase the `$(TargetFrameworkVersion)` or decrease the `android:targetSdkVersion` in the `AndroidManifest.xml` so that the API levels match.
XABBA7024: Xamarin.Tools.Zip.ZipIOException: The file 'obj\Release\130\android\bin\base.zip' is not a ZIP archive.
   at Xamarin.Tools.Zip.ZipArchive.Open(String path, FileMode mode, String defaultExtractionDir, Boolean strictConsistencyChecks, IPlatformOptions options) in /Users/runner/work/1/s/LibZipSharp/Xamarin.Tools.Zip/ZipArchive.cs:line 282
   at Xamarin.Android.Tasks.BuildApk.ExecuteWithAbi(String[] supportedAbis, String apkInputPath, String apkOutputPath, Boolean debug, Boolean compress, IDictionary`2 compressedAssembliesInfo, String assemblyStoreApkName)
   at Xamarin.Android.Tasks.BuildApk.RunTask()
   at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/runner/work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 17

I have tried many ways to make this project able to archived in AAB bundle format since its required by Google due to Google Policy.

I have tried

  1. Make sure the API 34 downloaded successfully on the path C:\Program Files (x86)\Android\android-sdk\platforms
  2. Enable AndroidX Migrator (Experimental)
  3. Trying to clean -> close project -> delete bin and obj folder and trying to re-opened the project. I still got the same issue.
  4. Make sure my manifest already set targetSdkVersion to 34 both release and debug version
  5. Trying running my VS2022 with Administrator Privilege.
  6. Add <TargetFrameworkVersion>v14.0</TargetFrameworkVersion> on the .csproj file
  7. Trying to replace the base zip file from SDK build 33 to 34 but with no luck
  8. Updating SDK tools and build tools to the latest version
  9. Create new blank project from template (Xamarin Project) and change to targetSdkVersion to 34 and still got the same error.
  10. Here is my AndroidManifest.xml file, I just change the targetSdkVersion from 33 to 34 as below
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="34" />

Finding:

  1. If I changed back to API 33, everything turns normally. I can archive the aab file as normal.
  2. If the error occurs, the base.zip files on the \obj\Release\130\android\bin will corrupted.
  3. This issue occurs both on the release and debug mode.
  4. The clean and build and rebuild process is success but the archive failed.
  5. Both APK and AAB bundle format produce similar issue.

Android Version

  1. Android SDK Plaftorm-tools v 34.0.3
  2. Android SDK command-line tools v 7.0
  3. Android SDK Build-tools 33.0.2

My Visual Studio version

Microsoft Visual Studio Enterprise 2022
Version 17.6.4

I have read several article for this and no solution that works. Any idea? Thank you

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,368 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 68,486 Reputation points
    2024-11-01T17:34:21.9866667+00:00

    Try upgradinging your visual studio. I believe you need at least vs 2022 v17.8 to support api 34 (17.11 is the current).

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.