Skip to content
  • Marek Habersack's avatar
    [Xamarin.Android.Build.Tasks] Remove support for mkbundle (#7772) · d0701eb7
    Marek Habersack authored
    Fixes: https://github.com/xamarin/xamarin-android/issues/7764
    
    Context: d236af54
    Context: https://github.com/xamarin/AndroidX/issues/64#issuecomment-609970584
    
    .NET Android dropped support for `$(BundleAssemblies)`=True; see also
    commit d236af54 and [a comment on xamarin/AndroidX#64][0]:
    
    > After internal discussion, we are strongly considering removing
    > support for `$(BundleAssemblies)` in .NET 5, as it increases
    > on-device memory use and slows down app startup times.
    
    However, this "dropping of support" was incomplete; setting it would
    result in broken apps!
    
    	% dotnet new android -n android-ba
    	% cd android-ba
    	% dotnet build -p:BundleAssemblies=true
    	# run the app, or just look at the .apk contents
    	% unzip -l bin/Debug/net7.0-android/*-Signed.apk | grep assem
    	      660  02-03-2023 14:13   assemblies/rc.bin
    	# Note: `assemblies/assemblies.blob` is not present, but is required!
    
    Fix this by *removing* most usage of the `$(BundleAssemblies)` MSBuild
    property as well as all the code affected by it.
    
      - Stop running bundle test apps on CI
      - Remove bundle unit tests
      - Remove the `CodeGen-MkBundle` project from the tests solution
      - Remove the `Xamarin.Android.MakeBundle-Tests` from the tests
        solution
      - Remove all native code (and configuration) related to mkbundle
      - Warn about `$(BundleAssemblies)` usage in .NET projects.
        A XA1035 warning will be emitted when `$(BundleAssemblies)`=True
        in .NET Android apps.
    
    Preserve a couple of related properties in the `<BuildApk/>` and
    `<GeneratePackageManagerJava/>` tasks, because they are still
    used by the debugger targets from `xamarin/monodroid`.
    
    [0]: https://github.com/xamarin/AndroidX/issues/64#issuecomment-6099
    d0701eb7