Android不承认org.apache.commons.validator [英] android doesn't recognize org.apache.commons.validator

查看:151
本文介绍了Android不承认org.apache.commons.validator的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要检查URL地址的有效性,所以经过一番研究,我发现使用apache.commons.validator.UrlValidator类是一个很好的解决方案,要做到这一点,这是code的例子:

I want to check the validity of a URL address, so after some research, i find that using apache.commons.validator.UrlValidator class is a good solution to do that, this is an example of code :

    import org.apache.commons.validator.UrlValidator;

    public class ValidateUrlExample{

public static void main(String[] args) {

    UrlValidator urlValidator = new UrlValidator();

    //valid URL
    if (urlValidator.isValid("http://www.mkyong.com")) {
       System.out.println("url is valid");
    } else {
       System.out.println("url is invalid");
    }

    //invalid URL
    if (urlValidator.isValid("http://invalidURL^$&%$&^")) {
        System.out.println("url is valid");
    } else {
        System.out.println("url is invalid");
    }

}
}

但是Android不承认阶级org.apache.commons.validator
有谁知道我应该怎么做才能解决这个问题?

but android doesn't recognize the class "org.apache.commons.validator" Does anyone know what should I do to fix that ?

在此先感谢

推荐答案

如果您仍然想使用Apache Commons验证库,那么你只需要下载的图书馆并与您的应用程序打包。

If you still want to use the apache commons validator library, then you just need to download the library and package it with your app.

这篇关于Android不承认org.apache.commons.validator的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆