Java – Import Android-DirectoryChooser into Eclipse

Import Android-DirectoryChooser into Eclipse… here is a solution to the problem.

Import Android-DirectoryChooser into Eclipse

I’m trying to include a directory selector feature in my Android app, but apparently I can’t import the library I found. This is the library I want to use: https://github.com/passy/Android-DirectoryChooser

I follow these steps:

  • Download the zip file and import it into Eclipse (import -> existing Android code to the workspace -> select library items only). The tree now looks like this:

    enter image description here

  • Right-click the main item and select Is Library
  • Right-click the Java folder in the main project and select Use as Source Folder
  • Right-click My Project and add main library in the Android tab; Also added libraries in the Java Build Path tab, which now looks like this:

    enter image description here

I

don’t know what I’m missing, but this line

import net.rdrei.android.dirchooser.DirectoryChooserActivity;

Give me an error saying the import network cannot be parsed. How do I import this library correctly?

Solution

You have imported the library “main” as a java library, not as an Android library. Follow the steps mentioned in this link:
adding-android-library-project-to-eclipse-build-path

Related Problems and Solutions