I use the same code to test, it works well in java project, but it cannot work rightly in android project.
I'm very sure that the lib has been in classpath, but the class could not be found!
The error as follows, can someone help me ?
Code:
...
05-21 11:34:55.608: E/AndroidRuntime(24489): Caused by: javax.validation.ValidationException: Unable to find provider: class org.hibernate.validator.HibernateValidator
05-21 11:34:55.608: E/AndroidRuntime(24489): at javax.validation.Validation$ProviderSpecificBootstrapImpl.configure(Validation.java:223)
The code is:
Code:
private static Validator validator;
static {
// it doesn't work too
// ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
// validator = factory.getValidator();
HibernateValidatorConfiguration config = Validation.byProvider( HibernateValidator.class ).configure();
ValidatorFactory factory = config.buildValidatorFactory();
validator = factory.getValidator();
}