开发者社区> cxycappuccino> 正文

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;  

 

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

相关文章
Git使用commit命令时报错“bad numeric config value ‘ture‘ for ‘color.ui‘: invalid unit”(已解决)
Git使用commit命令时报错“bad numeric config value ‘ture‘ for ‘color.ui‘: invalid unit”(已解决)
43 0
编译OpenJDK8:error: control reaches end of non-void function [-Werror=return-type]
编译OpenJDK8:error: control reaches end of non-void function [-Werror=return-type]
31 0
opencv出错:error: (-213:The function/feature is not implemented) Unknown/unsupported array type
opencv出错:error: (-213:The function/feature is not implemented) Unknown/unsupported array type
96 0
Sap Ds Data is not available. Increase the time-out interval values in Debug | Options
Sap Ds Data is not available. Increase the time-out interval values in Debug | Options
29 0
SAP WM Storage Type Capacity Check Method 5 (Usage check based on SUT)
SAP WM Storage Type Capacity Check Method 5 (Usage check based on SUT)
61 0
SAP WM 为Storage Type 004激活SUM报错 - Storage types without pick-point stor.type require partial pallet
SAP WM 为Storage Type 004激活SUM报错 - Storage types without pick-point stor.type require partial pallet
61 0
【错误记录】Tinker 热修复示例运行报错 ( patch receive fail: /storage/emulated/0/patch_signed_7zip.apk, code: -2)
【错误记录】Tinker 热修复示例运行报错 ( patch receive fail: /storage/emulated/0/patch_signed_7zip.apk, code: -2)
180 0
CPS fact debug - Continuation-pass style
Created by Wang, Jerry, last modified on Dec 24, 2015
40 0
2015-03-18 - Deliberately pass a wrong note type for my task creation
2015-03-18 - Deliberately pass a wrong note type for my task creation
27 0
custom field further usage - add into UI and report
custom field further usage - add into UI and report
53 0
+关注
cxycappuccino
架构,编程语言相关技术专家
文章
问答
视频
文章排行榜
最热
最新
相关电子书
更多
Spark SQL: Past, Present and Future
立即下载
Spark SQL:Past Present &Future
立即下载
Tracking-Ransomware-End-To-End
立即下载