Caused by: java.lang.IllegalArgumentException: Unknown pattern character 'o'
仔细检查字符串  里面有“o”

解决方案 »

  1.   


    先谢谢你的回复,实际上你也看到了Pattern中并没有'o'
      

  2.   

    new SimpleDateFormat(pattern, Locale.ENGLISH);试试这种方式
      

  3.   

    TimeUtil.java:52  这行代码是啥
      

  4.   


    先谢谢哥们的回复,问题我找到了;我先贴出一段有问题的代码,以防别人也搜到这个帖子,然后无解~哎@SuppressLint("SimpleDateFormat")
    public class TimeUtil {
    private static Context context = GlobalVars.applicationContext;
    private static final String TODAY = context.getResources().getString(
    R.string.today);
    private static final String YESTERDAY = context.getResources().getString(
    R.string.yesterday);
    private static final String HOURSAGO = context.getResources().getString(
    R.string.hoursAgo);
    private static final String MINUTESAGO = context.getResources().getString(
    R.string.minutesAgo);
    private static final String DAYSAGO = context.getResources().getString(
    R.string.daysAgo);
    private static final String JUSTNOW = context.getResources().getString(
    R.string.justNow);
    private static final String YEAR = context.getResources().getString(
    R.string.year);
    private static final String MONTH = context.getResources().getString(
    R.string.month);
    private static final String DAY = context.getResources().getString(
    R.string.day);
    private static final SimpleDateFormat dateTimeFormat = new SimpleDateFormat(
    "yyyy-MM-dd HH:mm");
    private static final SimpleDateFormat dateFormatAccurateToSecond = new SimpleDateFormat(
    "yyyy-MM-dd HH:mm:ss", Locale.getDefault());
    private static final SimpleDateFormat dateFormat = new SimpleDateFormat(
    "yyyy-MM-dd");
    private static final SimpleDateFormat timeFormat1 = new SimpleDateFormat(
    "HH:mm"); private static final SimpleDateFormat timeFormat2 = new SimpleDateFormat(
    "HH:mm:ss"); private static final SimpleDateFormat timeFormat3 = new SimpleDateFormat(
    "yyyy"); private static final SimpleDateFormat timeFormatFriendly = new SimpleDateFormat(
    "MM" + MONTH + "dd" + DAY + " HH:mm");
    问题就是最后一句: private static final SimpleDateFormat timeFormatFriendly = new SimpleDateFormat(
    "MM" + MONTH + "dd" + DAY + " HH:mm");
    不支持有 中文解析格式;因为英文是通用的,但是在不同的时区,可以有自己不同的时间格式;
    比如这里的中文,在中文zn环境下,一点事儿没有;
    但是环燥了en或者其他环境下,那就直接force close了;
    悲催;