I've added some of the Android support libraries to my project and now I'm basically facing the same problem as described in this question: Android Studio exports strings from support library to APK
Since I can't use Gradle settings with Xamarin, I can't use the solution described in the StackOverflow answer.
Does anyone have an idea, how I can keep only specific localization in my final APK file?
Generally, in Xamarin, The AndroidManifest handles special instructions for uses of libraries The Android.App.UsesLibraryAttribute(string name, bool required) sets specific inclusions and exclusion that will be in the generated Manifest.XML.
Also as far as I know there are only three ways to set link exclusions, the first and second are mentioned by @sunseeker, however Xamarin documentation and dev notes strongly recommend not using Full as indicated above and in general advocate using the following:
SdkOnly(default)
the second also mentioned above is for specific exclusions, it is also recommended not using this unless you are sure a particular package is not getting called "behind the scenes" by an extended class further up in the hierarchy.
Finally in the third method is to set LinkMode to None, while specific linkings are stipulated using the AndroidManifest interface.
Some other ways to get efficiencies are to:
set AndroidUseSharedRuntime property to true at least while debugging to reduce package size.
set AotAssemblies property to true when you have a stable build to precompile the libraries that are included.
set EmbedAssembliesIntoApk to false unless it is a release build.
That's about as far build knowledge goes with Xamarin, hope it helps.
Can't really check it now, but have you had a look at AndroidLinkSkip
and AndroidLinkMode
(reference) tags in a solution .csproj
file?
So, it'd be something like
<AndroidLinkMode>Full</AndroidLinkMode>
<AndroidLinkSkip>Mono.Android.Export;I18N;I18N.West</AndroidLinkSkip>
Also, have a look at MandroidI18n
. From the same reference above:
Specifies the internationalization support included with the Application, such as collation and sorting tables. The value is a comma- or semicolon-separated list of one or more of the case-insensitive values
<MandroidExtraArgs>-i18n=west</MandroidExtraArgs>
or
<MandroidI18n>West</MandroidI18n>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With