Include wav files in android app using buildozer

822 views
Skip to first unread message

Lorenz Jung

unread,
Aug 25, 2014, 1:29:14 PM8/25/14
to kivy-...@googlegroups.com
Hi all,
I am trying to develop an android app using kivy. The app is supposed to play some wav files, when certain buttons are pressed. On my mac, everything works fine, the audio files are played.
I created an android APK using buildozer. In the buildozer spec file, I commented out the line which source files should be included, so that all filetypes are included. 
Nevertheless, when I start the app on my android device, it works fine until I hit the "Play Audio" button. Then it crashes, like it isn't able to access the audio file.

Do you have an idea? Do I maybe have to adress the audio files diffently in the .py file, like giving the absolute path from the android device? I am new to kivy programming, and very grateful for any hints! Thank you.

Regards 
Lorenz

Ben Rousch

unread,
Aug 25, 2014, 1:47:03 PM8/25/14
to kivy-...@googlegroups.com
Add wav to line 16 (source.include_exts) of your buildozer.spec


--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
 Ben Rousch
   bro...@gmail.com
   http://clusterbleep.net/

Lorenz Jung

unread,
Aug 25, 2014, 2:39:18 PM8/25/14
to kivy-...@googlegroups.com
I already tried that, it still doesn't work. 
Do you have any other ideas?

Ben Rousch

unread,
Aug 25, 2014, 2:41:03 PM8/25/14
to kivy-...@googlegroups.com
You are assuming the crash is due to a problem with not finding the wavs. You should get an adb logcat of a run to be sure that is the problem.

Lorenz Jung

unread,
Aug 26, 2014, 1:25:27 PM8/26/14
to kivy-...@googlegroups.com
Well, the logcat contains the following:

I/python  ( 2195):  IOError: [Errno 2] No such file or directory: '/Users/lorenz..../...file.wav'

I/python  ( 2195): Python for android ended.


The mentioned directory is on my computer, where I stored the wav files. So I assume in the .py file, I have to refer to a directory on my android device, where I store the wav files, right?

ZenCODE

unread,
Aug 27, 2014, 1:57:08 AM8/27/14
to kivy-...@googlegroups.com
Yup. Relative path names are usually best e.g. "audio/file.wav" will find the wav file in a "audio" subfolder relative to your main.py. Not sure how you are specifying you file path now? If you still have hassles, try logging the output of "os.path.abspath(<filname>)" to see the full name the path resolves to, or "os.walk"  to explore what is you current folder...

Good luck

Lorenz Jung

unread,
Aug 27, 2014, 4:53:51 AM8/27/14
to kivy-...@googlegroups.com
Using relative path names solved my problem. 
Thank you guys!
Reply all
Reply to author
Forward
0 new messages