Try upgradinging your visual studio. I believe you need at least vs 2022 v17.8 to support api 34 (17.11 is the current).
Xamarin support for Android API 34 (14)
Yohanes AI
0
Reputation points
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
- Make sure the API 34 downloaded successfully on the path
C:\Program Files (x86)\Android\android-sdk\platforms
- Enable AndroidX Migrator (Experimental)
- Trying to clean -> close project -> delete
bin
andobj
folder and trying to re-opened the project. I still got the same issue. - Make sure my manifest already set
targetSdkVersion
to 34 both release and debug version - Trying running my VS2022 with Administrator Privilege.
- Add
<TargetFrameworkVersion>v14.0</TargetFrameworkVersion>
on the.csproj
file - Trying to replace the base zip file from SDK build 33 to 34 but with no luck
- Updating SDK tools and build tools to the latest version
- Create new blank project from template (Xamarin Project) and change to targetSdkVersion to 34 and still got the same error.
- Here is my
AndroidManifest.xml
file, I just change thetargetSdkVersion
from 33 to 34 as below
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="34" />
Finding:
- If I changed back to API 33, everything turns normally. I can archive the aab file as normal.
- If the error occurs, the
base.zip
files on the\obj\Release\130\android\bin
will corrupted. - This issue occurs both on the release and debug mode.
- The clean and build and rebuild process is success but the archive failed.
- Both APK and AAB bundle format produce similar issue.
Android Version
- Android SDK Plaftorm-tools v 34.0.3
- Android SDK command-line tools v 7.0
- 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