在使用Xamarin时遇到如下两个问题,花费很多时间
1、在Debug方式时可用使用 GBK 字符集,发行版不行
2、使用动态编译的代码Debug方式时可用使用,发行版使用Runtime库可用,形成单独 apk 出错。
解决办法:
Android Option 如下修改:
CJK 指定支持双字节编码
Skip linking assembiles 解决第二个问题,使用 linking 的 None 选项也能解决问题,但 apk 包太大。 原因如下:
Xamarin.Android applications use a
linker in order to reduce the size of the application. The linker employes static analysis of your application to determine which assemblies are actually used, which types are actually used, and which members are actually used. The linker then behaves like a
garbage collector, continually looking for the assemblies, types, and members that are referenced until the entire closure of referenced assemblies, types, and members is found. Then everything outside of this closure is
discarded.
Linker Behavior
The primary mechanism for controlling the linker is the Linker Behavior drop-down within the Project Options dialog box. There are three options:
- Don't Link
- Link SDK Assemblies
- Link All Assemblies
The Don't Link option turns off the linker; the above "Release without Linking" application size used this behavior. This is useful for troubleshooting runtime failures, to see if the linker is responsible.
The Link SDK Assemblies option only links assemblies that come with Xamarin.Android. All other assemblies are not linked.
The Link All Assemblies option links all assemblies.