Android import java.nio.file.Files; cannot be resolved

强颜欢笑 提交于 2019-11-26 16:35:41

Android does not offer all classes that "conventional java" has to offer. Files is one of the classes, that Android doesn't offer.

You can have a look at the classes available in Android here: http://developer.android.com/reference/classes.html

So unfortunately you have to use other functions / classes to implement the same functionality.

PS: The class is shown in your screenshot because you browse the classes of java installed on your PC, not those that are be available on the Android phone / tablet.

Update

The Files/FileSystem classes have become available starting with API version 26.

Apparently java.nio.file is coming with Android O. https://developer.android.com/reference/java/nio/file/package-summary.html

Have a Look of this Link Android support some classes of NIO packages not full classes. But if you need to fast-up your code you can also use apache-commons api for the same.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!