0
0

I’m all new so fmod so I just might be overlooking something really simple. 😮

I’ve downloaded fmodapi43806android.tar.gz (fmod for Android) and executed the .bat installer script. Then followed the instructions in the Getting started with FMOD for Android.pdf file. Page 8 of 9 in the PDF says at some point:
[quote:8hcvylip]Resolve the FMOD_LIB reference by setting a class path variable to the installed file:
Window -> Preferences -> Java -> Build Path -> Classpath Variables -> New
FMOD_LIB = "C:\Program Files\FMOD SoundSystem\FMOD Programmers API Android\api\lib\fmodex.jar"[/quote:8hcvylip]

Thing is, there is no folder called "FMOD Programmers API Android" on my computer. I looked in the sub folder api\lib\ of "FMOD Programmers API Windows" but there is no file fmodex.jar as described in the documentation.
So instead I copied the fmodex.jar file found in the tar.gz file to C:\fmod\ and set the classpath variable to there.

I’ve set the environmental variable ANDROID_NDK_ROOT to my Android NDK folder (set to: C:\Users\de\Development\Android\Android SDK\android-ndk-r7).

Then imported some example projects to eclipse. Looks fine, I don’t get any errors in eclipse.

The problem now is that the app immediately crashes when opened on my Nexus One phone. The logfile looks like this:
[quote:8hcvylip]01-10 22:05:57.552: E/AndroidRuntime(7895): FATAL EXCEPTION: main
01-10 22:05:57.552: E/AndroidRuntime(7895): java.lang.ExceptionInInitializerError
01-10 22:05:57.552: E/AndroidRuntime(7895): at java.lang.Class.newInstanceImpl(Native Method)
01-10 22:05:57.552: E/AndroidRuntime(7895): at java.lang.Class.newInstance(Class.java:1409)
01-10 22:05:57.552: E/AndroidRuntime(7895): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
01-10 22:05:57.552: E/AndroidRuntime(7895): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
01-10 22:05:57.552: E/AndroidRuntime(7895): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
01-10 22:05:57.552: E/AndroidRuntime(7895): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
01-10 22:05:57.552: E/AndroidRuntime(7895): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
01-10 22:05:57.552: E/AndroidRuntime(7895): at android.os.Handler.dispatchMessage(Handler.java:99)
01-10 22:05:57.552: E/AndroidRuntime(7895): at android.os.Looper.loop(Looper.java:130)
01-10 22:05:57.552: E/AndroidRuntime(7895): at android.app.ActivityThread.main(ActivityThread.java:3683)
01-10 22:05:57.552: E/AndroidRuntime(7895): at java.lang.reflect.Method.invokeNative(Native Method)
01-10 22:05:57.552: E/AndroidRuntime(7895): at java.lang.reflect.Method.invoke(Method.java:507)
01-10 22:05:57.552: E/AndroidRuntime(7895): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
01-10 22:05:57.552: E/AndroidRuntime(7895): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
01-10 22:05:57.552: E/AndroidRuntime(7895): at dalvik.system.NativeStart.main(Native Method)
01-10 22:05:57.552: E/AndroidRuntime(7895): Caused by: java.lang.UnsatisfiedLinkError: Couldn’t load fmodex: findLibrary returned null
01-10 22:05:57.552: E/AndroidRuntime(7895): at java.lang.Runtime.loadLibrary(Runtime.java:429)
01-10 22:05:57.552: E/AndroidRuntime(7895): at java.lang.System.loadLibrary(System.java:554)
01-10 22:05:57.552: E/AndroidRuntime(7895): at org.fmod.effects.Example.<clinit>(Example.java:100)
01-10 22:05:57.552: E/AndroidRuntime(7895): … 15 more
[/quote:8hcvylip]

What am I doing wrong here? Thanks for help!

  • You must to post comments
0
0

Unfortunately I don’t have an example to direct you to, however I have recorded that an official FMOD example that demonstrates this would be very useful.

I am not overly familiar with the resource API, but from memory I believe it returns a file handle? You could try using the ‘filecallbacks’ example, substituting resource API file IO calls instead of POSIX file IO.

  • You must to post comments
0
0

Ah the docs are a little out of date, we used to ship an installer that would put the files in that Program Files path, however the Android SDK / NDK tools don’t like paths with space, so we switched to just providing a zip you can put anywhere.

You still need to resolve FMOD_LIB to the location of fmodex.jar, which it sounds like you have done correctly since the project compiles.

Looking at the error, I’d say the app cannot find the fmod libraries. The examples are set up relative to the api/lib dir so the Android.mk can find them, have you moved the examples around without keeping the libs relative?

  • You must to post comments
0
0

Ah ok, I didn’t copy all the files from the tar.gz file into the folder c:\fmod\
So now I copied all files to that directory and updated the FMOD_LIB classpath to C:\fmod\api\lib\fmodex.jar
Now the relative path structure ought to be correct.

[code:25gd60f4]
C:\fmod\api\
C:\fmod\examples\
C:\fmod\fmoddesignerapi\
C:\fmod\tools\
[/code:25gd60f4]

The examples are still crashing though. With the same logfile output like before. :(

Going through the instructions again I was wondering about this part:
[quote:25gd60f4]Copy all the files from the two sets of example media "examples\media*" and "fmoddesignerapi\examples\media*" to the device SDCard, "sdcard\fmod*"[/quote:25gd60f4]

Why do I have to copy all those files to the SD card if I run the examples through Eclipse on my phone? Is this step really required?
Anyways, I did copy all the files from the examples\media\ and fmoddesignerapi\examples\media\ folders to the directory "\fmod\" of my SD card. Just to be sure I also copied them also to the folder "\sdcard\fmod\" on my SD card.

Then going back to eclipse and try running the "submixing" example as an Android application. App still crashes immediately. Logfile is this:

[quote:25gd60f4]01-11 09:55:14.356: E/AndroidRuntime(11032): FATAL EXCEPTION: main
01-11 09:55:14.356: E/AndroidRuntime(11032): java.lang.ExceptionInInitializerError
01-11 09:55:14.356: E/AndroidRuntime(11032): at java.lang.Class.newInstanceImpl(Native Method)
01-11 09:55:14.356: E/AndroidRuntime(11032): at java.lang.Class.newInstance(Class.java:1409)
01-11 09:55:14.356: E/AndroidRuntime(11032): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
01-11 09:55:14.356: E/AndroidRuntime(11032): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
01-11 09:55:14.356: E/AndroidRuntime(11032): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
01-11 09:55:14.356: E/AndroidRuntime(11032): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
01-11 09:55:14.356: E/AndroidRuntime(11032): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
01-11 09:55:14.356: E/AndroidRuntime(11032): at android.os.Handler.dispatchMessage(Handler.java:99)
01-11 09:55:14.356: E/AndroidRuntime(11032): at android.os.Looper.loop(Looper.java:130)
01-11 09:55:14.356: E/AndroidRuntime(11032): at android.app.ActivityThread.main(ActivityThread.java:3683)
01-11 09:55:14.356: E/AndroidRuntime(11032): at java.lang.reflect.Method.invokeNative(Native Method)
01-11 09:55:14.356: E/AndroidRuntime(11032): at java.lang.reflect.Method.invoke(Method.java:507)
01-11 09:55:14.356: E/AndroidRuntime(11032): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
01-11 09:55:14.356: E/AndroidRuntime(11032): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
01-11 09:55:14.356: E/AndroidRuntime(11032): at dalvik.system.NativeStart.main(Native Method)
01-11 09:55:14.356: E/AndroidRuntime(11032): Caused by: java.lang.UnsatisfiedLinkError: Couldn’t load fmodex: findLibrary returned null
01-11 09:55:14.356: E/AndroidRuntime(11032): at java.lang.Runtime.loadLibrary(Runtime.java:429)
01-11 09:55:14.356: E/AndroidRuntime(11032): at java.lang.System.loadLibrary(System.java:554)
01-11 09:55:14.356: E/AndroidRuntime(11032): at org.fmod.submixing.Example.<clinit>(Example.java:81)
01-11 09:55:14.356: E/AndroidRuntime(11032): … 15 more
[/quote:25gd60f4]

Did I forget doing/set anything?

  • You must to post comments
0
0

The reason for the SD card is because the primary method for loading media with FMOD is by path, with Android you can only load files by path from the SD card. If you bind your audio into the application you need to use the SDK / NDK APIs to access the data and feed it to FMOD. Basically the examples load by path for simplicity.

Regarding the file not found, have you cleaned the project and rebuilt since moving the files to the correct relative path? Also have you tried using the device file system explorer to check that the libs are in fact where they are supposed to be?

  • You must to post comments
0
0

[quote:3k9xzn82]Regarding the file not found, have you cleaned the project and rebuilt since moving the files to the correct relative path? Also have you tried using the device file system explorer to check that the libs are in fact where they are supposed to be?[/quote:3k9xzn82]

Cleaning all demo projects with Eclipse -> Check
Checking with the DDMS / File Explorer tool that all the files are in the directory /sdcard/fmod/ -> Check
In that subfolder are all demo projects with the classic Android structure. With the AndroidManifest.xml file and the subfolders /src/ and /res/ etc.

Tried to load some apps such as effects, playlist, playsound, playstream, soundgroups and submixing. All the apps crash immediately.
LogCat is always the same:
[code:3k9xzn82]01-12 22:30:06.784: E/AndroidRuntime(27381): FATAL EXCEPTION: main
01-12 22:30:06.784: E/AndroidRuntime(27381): java.lang.ExceptionInInitializerError
01-12 22:30:06.784: E/AndroidRuntime(27381): at java.lang.Class.newInstanceImpl(Native Method)
01-12 22:30:06.784: E/AndroidRuntime(27381): at java.lang.Class.newInstance(Class.java:1409)
01-12 22:30:06.784: E/AndroidRuntime(27381): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
01-12 22:30:06.784: E/AndroidRuntime(27381): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
01-12 22:30:06.784: E/AndroidRuntime(27381): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
01-12 22:30:06.784: E/AndroidRuntime(27381): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
01-12 22:30:06.784: E/AndroidRuntime(27381): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
01-12 22:30:06.784: E/AndroidRuntime(27381): at android.os.Handler.dispatchMessage(Handler.java:99)
01-12 22:30:06.784: E/AndroidRuntime(27381): at android.os.Looper.loop(Looper.java:130)
01-12 22:30:06.784: E/AndroidRuntime(27381): at android.app.ActivityThread.main(ActivityThread.java:3683)
01-12 22:30:06.784: E/AndroidRuntime(27381): at java.lang.reflect.Method.invokeNative(Native Method)
01-12 22:30:06.784: E/AndroidRuntime(27381): at java.lang.reflect.Method.invoke(Method.java:507)
01-12 22:30:06.784: E/AndroidRuntime(27381): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
01-12 22:30:06.784: E/AndroidRuntime(27381): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
01-12 22:30:06.784: E/AndroidRuntime(27381): at dalvik.system.NativeStart.main(Native Method)
01-12 22:30:06.784: E/AndroidRuntime(27381): Caused by: java.lang.UnsatisfiedLinkError: Couldn’t load fmodex: findLibrary returned null
01-12 22:30:06.784: E/AndroidRuntime(27381): at java.lang.Runtime.loadLibrary(Runtime.java:429)
01-12 22:30:06.784: E/AndroidRuntime(27381): at java.lang.System.loadLibrary(System.java:554)
01-12 22:30:06.784: E/AndroidRuntime(27381): at org.fmod.playstream.Example.<clinit>(Example.java:65)
01-12 22:30:06.784: E/AndroidRuntime(27381): ... 15 more
[/code:3k9xzn82]

The demo projects all use Android 2.2, the "Native library location" is set to "null". Do I need to change anything there?

I’m using a Nexus One phone with Android 2.3.6.

I’m out of ideas, how can I make this work? I need to use fmod for a customer project and really have to get this to work.

  • You must to post comments
0
0

Do you get any errors from the Eclipse console when you build? Keep in mind I need to build twice to get it to completely build (weird quirk of Eclipse).

You should see something like:
bash C:\Android\ndk\ndk-build all
(then 4 installs for two fmod libs and two main libs)

  • You must to post comments
0
0

I think I’m a few steps further.

I don’t get an error when I build the demo apps in Eclipse. I realized I didn’t properly install Android NDK. So I did it and then went to the project folder (the fmod demo apps) and executed "ndk-build". The script ran through. Then I switched to Eclipse, cleaned all the projects and tried to run the "channelgroups" app.
This time the app did not crash! However, it got closed almost immediately after it was launched. The LogCat file looks like this now:

[quote:3iyh8vs7]01-13 23:10:00.270: D/dalvikvm(16971): Trying to load lib /mnt/asec/org.fmod.channelgroups-2/lib/libfmodex.so 0x40515020
01-13 23:10:00.330: D/dalvikvm(16971): Added shared lib /mnt/asec/org.fmod.channelgroups-2/lib/libfmodex.so 0x40515020
01-13 23:10:00.330: D/dalvikvm(16971): No JNI_OnLoad found in /mnt/asec/org.fmod.channelgroups-2/lib/libfmodex.so 0x40515020, skipping init
01-13 23:10:00.330: D/dalvikvm(16971): Trying to load lib /mnt/asec/org.fmod.channelgroups-2/lib/libmain.so 0x40515020
01-13 23:10:00.330: D/dalvikvm(16971): Added shared lib /mnt/asec/org.fmod.channelgroups-2/lib/libmain.so 0x40515020
01-13 23:10:00.330: D/dalvikvm(16971): No JNI_OnLoad found in /mnt/asec/org.fmod.channelgroups-2/lib/libmain.so 0x40515020, skipping init
01-13 23:10:00.360: E/fmod(16971): FMOD error! (23) File not found.
01-13 23:10:00.360: E/fmod(16971): jni/main.c:42
[/quote:3iyh8vs7]

I tried to build it (in Eclipse) several times but the problem remained the same. No force close of the app but an immediate closing of the app with the "fmod error!"

Any suggestions for that? Thanks again for help.

  • You must to post comments
0
0

Okay I finally managed to get the demos running 😀

Just some noted to the documentation[b:2dwi8o87] "Getting started with FMOD for Android.pdf"[/b:2dwi8o87], page 8/9:

It would be great if you could stress more that the NDK has to be installed completely. Meaning that also Cygwin has to be installed (inclusive "make") and that each project actually has to be built first (twice?) using Cygwin Terminal.
Since I didn’t have NDK installed nor used NDK at all prior to reading the fmod documentation I assumed it was enough to unpack the NDK files.

The part:
[quote:2dwi8o87]FMOD_LIB = "C:\Program Files\FMOD SoundSystem\FMOD Programmers API Android\api\lib\fmodex.jar"[/quote:2dwi8o87]
Is wrong and this directory doesn’t exist in the fmodapi43806android.tar.gz file.

and
[quote:2dwi8o87]Copy all the files from the two sets of example media "examples\media*" and "fmoddesignerapi\examples\media*" to the device SDCard, "sdcard\fmod*"[/quote:2dwi8o87]

I first copied the files to a sub folder /sdcard/ instead copying them to the root directory of the SD card. Perhaps rephrasing that sentence would make it more clear.

I know, the above listed points were all my faults. However, these are just some ideas how you could improve your documentations for future readers.

  • You must to post comments
0
0

Thanks for your suggestions and I’m glad you got the examples working.

I have reworked the docs to be clearer for people starting out with FMOD in the future.

  • You must to post comments
0
0

[quote="mathew":yl073f7m]The reason for the SD card is because the primary method for loading media with FMOD is by path, with Android you can only load files by path from the SD card. If you bind your audio into the application you need to use the SDK / NDK APIs to access the data and feed it to FMOD. Basically the examples load by path for simplicity.
[/quote:yl073f7m]

Can you direct me to a simple example how to load a file (binded in my application, not external file on sdcard) using the NDK and feed it to the FMOD loader?

  • You must to post comments
Showing 10 results
Your Answer

Please first to submit.