protected ObjectInstantiator newInstantiator (final Class type) {
		if (!Util.isAndroid) {
			// ReflectASM.
			try {
				final ConstructorAccess access = ConstructorAccess.get(type);
				return new ObjectInstantiator() {
					public Object newInstance () {
						try {
							return access.newInstance();
						} catch (Exception ex) {
							throw new KryoException("Error constructing instance of class: " + className(type), ex);
						}
					}
				};
			} catch (Exception ignored) {
			}
		}
		// Reflection.
		try {
			Constructor ctor;
			try {
				ctor = type.getConstructor((Class[])null);
			} catch (Exception ex) {
				ctor = type.getDeclaredConstructor((Class[])null);
				ctor.setAccessible(true);
			}
			final Constructor constructor = ctor;
			return new ObjectInstantiator() {
				public Object newInstance () {
					try {
						return constructor.newInstance();
					} catch (Exception ex) {
						throw new KryoException("Error constructing instance of class: " + className(type), ex);
					}
				}
			};
		} catch (Exception ignored) {
		}
		if (strategy == null) {
			if (type.isMemberClass() && !Modifier.isStatic(type.getModifiers()))
				throw new KryoException("Class cannot be created (non-static member class): " + className(type));
			else
				throw new KryoException("Class cannot be created (missing no-arg constructor): " + className(type));
		}
		// InstantiatorStrategy.
		return strategy.newInstantiatorOf(type);
	}