iPaulPro / aFileChooser

[DEPRECATED] Android library that provides a file explorer to let users select files on external storage.
Apache License 2.0
1.79k stars 850 forks source link

NoClassDefFoundError when using aFileChooser with my app. #17

Closed fishnet37222 closed 11 years ago

fishnet37222 commented 11 years ago

Hello,

I get the exception linked below when I select the built-in aFileChooser to select a file for my app to process. The sample provided with aFileChooser works fine, however.

http://pastebin.com/hXaJ0jQ7

Instead of adding the aFileChooser project as a dependency, I copied the JAR file to my project's libs folder and added it to the build path. I did this because I host my project on Google Code and I didn't want anyone cloning my repository to have to clone other repositories as well.

carlosnavas commented 11 years ago
  <activity
        android:name="com.ipaulpro.afilechooser.FileChooserActivity"
        android:exported="false"
        android:icon="@drawable/ic_chooser"
        android:label="@string/choose_file" >
        <intent-filter>
            <action android:name="android.intent.action.GET_CONTENT" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.OPENABLE" />

            <data android:mimeType="*/*" />
        </intent-filter>
    </activity>
fishnet37222 commented 11 years ago

I already do have that in my AndroidManifest.xml. Before I added that, it wasn't even showing up in the chooser.

            <activity
                    android:name="com.ipaulpro.afilechooser.FileChooserActivity"
                    android:icon="@drawable/ic_launcher"
                    android:label="@string/choose_file" >
                    <intent-filter>
                            <action android:name="android.intent.action.GET_CONTENT" />

                            <category android:name="android.intent.category.DEFAULT" />
                            <category android:name="android.intent.category.OPENABLE" />

                            <data android:mimeType="*/*" />
                    </intent-filter>
            </activity>
fishnet37222 commented 11 years ago

Just as a test I changed my project to reference the aFileChooser project instead of just the JAR and it worked without the exception. Is it possible to get a JAR for this that I can just include in my project's libs folder?

fishnet37222 commented 11 years ago

Well, I got around this issue by adding the aFileChooser project to my repository. Now anyone who clones my repository won't have to worry about also cloning another repository.

iPaulPro commented 11 years ago

From the docs:

You cannot export the library project to a self-contained JAR file, as you would do for a true library. Instead, you must compile the library indirectly, by referencing the library in the dependent application and building that application.

See here for more details: http://stackoverflow.com/a/7973950/377260

Well, I got around this issue by adding the aFileChooser project to my repository. Now anyone who clones my repository won't have to worry about also cloning another repository.

Be sure to watch this repo for changes! The typical approach would be to add a git submodule, or simply specify as a dependency, but it is obviously up to you. :-)