Fixing serialization issues and Android issues.

Platform dependant code should not be loaded always.
Use static classes to avoid loading code if it's not used.
Bugfix with Android rectangle serialization.