0

Iam using lucene in android.i could not import java.nio.file.Path package

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);

Iam using lucene 5.2.1 For FSDirectory.open() parameter to be passed is of type Path...so how can i get path object of the directory mydir that i have created

2 Answers2

1

Lucene 5.0 to 5.2 won't work on Android, which I suppose they may fix in 5.3 or perhaps later.

Lucene 4.x works if you're persuasive enough, and René Treffer has a simple app on github that shows how to win Lucene's heart. You may prefer to use pickFirst rather than exclude in build.gradle, depending on what your code needs to do.

arnt
  • 8,949
  • 5
  • 24
  • 32
-1

Android doesn't offer the class you need.

If you want to see what classes you can use, take a look at http://developer.android.com/reference/classes.html

You have to use other functions.

If you want to know more about your problem, read https://stackoverflow.com/a/24869904/4968143

Community
  • 1
  • 1
Jan
  • 424
  • 1
  • 4
  • 13