Android compatibility fixes: custom class loader and clean-up class generation.