I have spent over a week looking into this issue, and I have tried nearly every solution to be found on SO and through google, but this is still unresolved for me.
I have an external library, gdx-audio.jar, which I have imported by placing it in my libs folder and adding it too the build path.
I am using the latest version of Eclipse Juno.
So my setup looks like this:
Notice the libs folder with with my jar, as well as that it shows up in Android Dependencies and Referenced libraries. Also, everything is checked in the order and export tab of the build path window, as has been a solution for some, but not for me.
Also the error message with the exception is shown in the logcat window. (Tried to fit everything in one screenshot).
I am a bit unsure of the correct ordering of the order and export, but I have tried numerous orderings to no avail. I have read in other peoples post to make sure gen is before src, and I have set the jar file to be made first.
Any help anyone can offer would be appreciated.
Is there anything special I need in my manifest file? Or am I just missing something small?
EDIT: Here is the LogCat output:
01-23 14:37:20.917: I/dalvikvm(6699): Failed resolving Lcom/badlogic/gdx/audio/analysis/KissFFT; interface 79 'Lcom/badlogic/gdx/utils/Disposable;'
01-23 14:37:20.917: W/dalvikvm(6699): Link of class 'Lcom/badlogic/gdx/audio/analysis/KissFFT;' failed
01-23 14:37:20.917: E/dalvikvm(6699): Could not find class 'com.badlogic.gdx.audio.analysis.KissFFT', referenced from method ubicomp.signalproccesor.SignalProcessorDemo.<init>
01-23 14:37:20.917: W/dalvikvm(6699): VFY: unable to resolve new-instance 65 (Lcom/badlogic/gdx/audio/analysis/KissFFT;) in Lubicomp/signalproccesor/SignalProcessorDemo;
01-23 14:37:20.917: D/dalvikvm(6699): VFY: replacing opcode 0x22 at 0x0009
01-23 14:37:20.917: I/dalvikvm(6699): Failed resolving Lcom/badlogic/gdx/audio/analysis/KissFFT; interface 79 'Lcom/badlogic/gdx/utils/Disposable;'
01-23 14:37:20.917: W/dalvikvm(6699): Link of class 'Lcom/badlogic/gdx/audio/analysis/KissFFT;' failed
01-23 14:37:20.917: D/dalvikvm(6699): DexOpt: unable to opt direct call 0x0186 at 0x0d in Lubicomp/signalproccesor/SignalProcessorDemo;.<init>
01-23 14:37:20.917: D/AndroidRuntime(6699): Shutting down VM
01-23 14:37:20.917: W/dalvikvm(6699): threadid=1: thread exiting with uncaught exception (group=0x40efd300)
01-23 14:37:20.917: E/AndroidRuntime(6699): FATAL EXCEPTION: main
01-23 14:37:20.917: E/AndroidRuntime(6699): java.lang.NoClassDefFoundError: com.badlogic.gdx.audio.analysis.KissFFT
01-23 14:37:20.917: E/AndroidRuntime(6699): at ubicomp.signalproccesor.SignalProcessorDemo.<init>(SignalProcessorDemo.java:41)
01-23 14:37:20.917: E/AndroidRuntime(6699): at java.lang.Class.newInstanceImpl(Native Method)
01-23 14:37:20.917: E/AndroidRuntime(6699): at java.lang.Class.newInstance(Class.java:1319)
01-23 14:37:20.917: E/AndroidRuntime(6699): at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
01-23 14:37:20.917: E/AndroidRuntime(6699): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
01-23 14:37:20.917: E/AndroidRuntime(6699): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
01-23 14:37:20.917: E/AndroidRuntime(6699): at android.app.ActivityThread.access$600(ActivityThread.java:130)
01-23 14:37:20.917: E/AndroidRuntime(6699): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
01-23 14:37:20.917: E/AndroidRuntime(6699): at android.os.Handler.dispatchMessage(Handler.java:99)
01-23 14:37:20.917: E/AndroidRuntime(6699): at android.os.Looper.loop(Looper.java:137)
01-23 14:37:20.917: E/AndroidRuntime(6699): at android.app.ActivityThread.main(ActivityThread.java:4745)
01-23 14:37:20.917: E/AndroidRuntime(6699): at java.lang.reflect.Method.invokeNative(Native Method)
01-23 14:37:20.917: E/AndroidRuntime(6699): at java.lang.reflect.Method.invoke(Method.java:511)
01-23 14:37:20.917: E/AndroidRuntime(6699): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
01-23 14:37:20.917: E/AndroidRuntime(6699): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
Just to verify, I loaded up a default project with the library files you are trying to use and verified the same issue. It's not your IDE configuration; the gdx-audio
JAR library is not meant to stand alone, it is an extension in the larger gdx
framework and depends on other classes in other JARs as part of that library package. Without the classes that KissFFT
(the class throwing the error) imports, that class cannot be loaded either.
Admittedly the error is a bit misdirecting, it should be telling you that the classes it can't find are com.badlogic.gdx.utils.Disposable
and com.badlogic.gdx.utils.SharedLibraryLoader
. It turns out the com.badlogic.gdx.utils
package is located inside the gdx.jar
file, so you have to include gdx.jar
in addition to gdx-audio.jar
to use that library extension.
As a reference, here's what your libs directory (at a minimum) needs to then look like:
In case you don't already have it, here is the link to that frameworks official site. I can't say for sure, but some of the required dependencies would hopefully be somewhere in their documentation: http://libgdx.badlogicgames.com/
SIDE NOTE: You should NEVER need to manually add your JAR files to the build path in an Android project using Eclipse. ADT does the job of taking everything from your libs/
directory and building it as a dependency. All you are doing by adding this is creating duplication that eventually will cause you more issues that will be just as hard to track if you ever use a build system besides the one inside Eclipse.
This is why you have to dependency sets in your project list. "Referenced Libraries" is the one created by Eclipse and should not be there. "Android Dependencies" is what ADT creates and should be the only library set listed (other than "Android x.x", which is your framework SDK).
Hope that Helps!