SimpleDateFormat 出现错误 Call requires API level 24 (current min is 15)

简介: 这个故事是这样的   今天写打卡时间的时候需要获取一下当前时间,然后我就写了一个这个   [java] view plain copy   SimpleDateFormat sDF =   new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");   tring date = sDF.

这个故事是这样的

 

今天写打卡时间的时候需要获取一下当前时间,然后我就写了一个这个

 

[java]  view plain  copy
 
  1. SimpleDateFormat sDF =   new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");  
  2. tring date = sDF.format(Date());  


然后alter+enter包导入

 

 

然后就出了一个这个

Call requires API level 24 (current min is 15): android.icu.text.SimpleDateFormat#SimpleDaormat

 

我开始以为是版本的问题,然后我就去下了一个新的SDK回来,折腾了三个小时发现无卵用

后来仔细看错误提示发现是包导入的问题……

 

应该导入

[java]  view plain  copy
 
  1. import java.text.SimpleDateFormat;  
  2. import java.util.Date;  

 

 

然后我智障自动导入了这个

 

[java]  view plain  copy
 
  1. import android.icu.text.SimpleDateFormat;  

 

相关文章
|
26天前
|
API
Date和SimpleDateFormat常用API
Date和SimpleDateFormat常用API
31 1
|
Shell
wandb.errors.UsageError: api_key not configured (no-tty). call wandb.login(key=[your_api_key])
wandb.errors.UsageError: api_key not configured (no-tty). call wandb.login(key=[your_api_key])
3285 0
wandb.errors.UsageError: api_key not configured (no-tty). call wandb.login(key=[your_api_key])
|
小程序 API
微信小程序错误 Cloud API isn‘t enabled, please call wx.cloud.init first 解决
微信小程序错误 Cloud API isn‘t enabled, please call wx.cloud.init first 解决
348 0
|
API
IDEA 告警:Stream API call chain can be simplified
IDEA 告警:Stream API call chain can be simplified
150 0
how to create authentication string for each twitter API call
how to create authentication string for each twitter API call
111 0
|
API 算法框架/工具
成功解决UserWarning: Update your `Conv2D` call to the Keras 2 API问题
成功解决UserWarning: Update your `Conv2D` call to the Keras 2 API问题
|
API Android开发
Android系统版本号和Android API level对应表
终于建了一个自己个人小站:https://huangtianyu.gitee.io,以后优先更新小站博客,欢迎进站,O(∩_∩)O~~       平时总会去查 Android系统版本号和Android API level对应关系,有时候上不了Google,网上搜的又不全。
1682 0
|
API 开发工具 Android开发
修改Android Studio默认的API Level(SDK版本)
原文:修改Android Studio默认的API Level(SDK版本) Android Studio(2.1.2)新建工程的时候只会让你选择最低支持的SDK版本,默认的目标编译SDK版本会以系统当前SDK中最新SDK platform作为目标的API Level。
3467 0