Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/202.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在android中获取path对象_Android_Path_Lucene - Fatal编程技术网

如何在android中获取path对象

如何在android中获取path对象,android,path,lucene,Android,Path,Lucene,我在android中使用lucene。我无法导入java.nio.file.Path包 import java.nio.file.Path;//this is not resolved in android studio //Creating an internal dir; File mydir = this.getDir("my_dir", Context.MODE_PRIVATE); if(!mydir.exists()) {

我在android中使用lucene。我无法导入java.nio.file.Path包

import java.nio.file.Path;//this is not resolved in android studio


 //Creating an   internal dir;
 File mydir = this.getDir("my_dir", Context.MODE_PRIVATE); 

        if(!mydir.exists())
        {
            mydir.mkdirs();
        }
        Path dirPath = mydir.toPath();
        Directory indexDir = FSDirectory.open(mydir);
使用lucene 5.2.1的Iam
要传递的FSDirectory.open()参数的类型为Path…因此,如何获取我创建的目录mydir的Path对象?Android不提供您需要的类

如果您想了解可以使用哪些类,请查看

你必须使用其他功能


如果你想更多地了解你的问题,请阅读《Lucene 5.0至5.2在Android上不起作用》,我想他们可能会在5.3或更高版本中解决这个问题


如果你有足够的说服力,Lucene 4.x就可以工作,这说明了如何赢得Lucene的心。您可能更喜欢使用,这取决于您的代码需要做什么。

java.nio.file
在Android SDK中不存在<代码>路径应该是常规的
文件
字符串
路径。但是FSDirectory.open()只接受路径对象…我无法发送字符串或文件类型的obj,那么您就不能使用
FSDirectory.open()
,因为它的依赖项没有填充。