问题描述
我想出来的新的Gmail API和示例使用类的java.nio.file包,EI 文件
和文件系统
。
I am trying out the new Gmail API and the samples use the classes in the java.nio.file package, e.i. Files
and FileSystems
.
这些课程中引入了Java的JDK 1.7的记录,因为我在我的Android应用程序运行JDK 1.7.0_65我不知道为什么Android的工作室找不到这些类。
These classes was introduced in Java jdk 1.7 for the record, and since I am running jdk 1.7.0_65 in my Android app I have no idea why Android Studio cannot find these classes.
的进口是:
import java.nio.file.FileSystems;
import java.nio.file.Files;
我build.gradle当然文件告诉系统使用v。1.7这样
My build.gradle file of course tells the system to use v. 1.7 like this
android {
compileSdkVersion 19
buildToolsVersion '20'
...
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
我指向的jdk的正确的目录:
I am pointing to the right directory of the jdk:
的JDK列在外部库部分:
The jdk is listed in the External Libraries section:
如果我通过Java文件浏览我甚至可以找到java.nio.file.Files和.FileSystems:
And if I browse through the Java files I can even find java.nio.file.Files and .FileSystems:
现在,什么****是怎么回事!?从我的理解我所做的一切就在这里,有什么建议?
推荐答案
Android不提供所有类传统的Java所提供的。 文件
是类之一,即Android不提供。
Android does not offer all classes that "conventional java" has to offer. Files
is one of the classes, that Android doesn't offer.
您可以看看的类机器人在这里可供选择:http://developer.android.com/reference/classes.html
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:该类显示在您的屏幕截图,因为你浏览的Java安装在您的 PC 的类,而不是那些可在Android手机/平板电脑
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.
这篇关于Android的进口java.nio.file.Files;不能得到解决的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!