I had a music player app built with kivy and ffpyplayer as its audio provider. Before deploying the program on android, I just wanted to do some testing.
Everything seemed to be fine, except the core thing that was supposed to work which was playing the audio files.
Everything works fine on desktop but when deployed on android, for some reason, kivy can't play the audio files and always returns:
[WARNING] [Audio ] Unable to find a loader for </data/data/org.test.audiotest/files/app/music/10_poker_face.mp3>
Someone said that it could be because ffpyplayer is a wrapper for ffmpeg and I may not have ffmpeg installed but to my knowledge, when I passed ffpyplayer as a requirement, it was detected as a recipe and installed a version of ffmpeg with itself.
Is there a specific modification that is needed to be done to the buildozer.spec file that I haven't already done?
Logcat output:
10-04 20:02:39.199 30572 31073 I python : Android kivy bootstrap done. __name__ is __main__
10-04 20:02:39.199 30572 31073 I python : AND: Ran string
10-04 20:02:39.199 30572 31073 I python : Run user program, change dir and execute entrypoint
10-04 20:02:39.384 30572 31073 I python : [WARNING] [Config ] Older configuration version detected (0 instead of 21)
10-04 20:02:39.384 30572 31073 I python : [WARNING] [Config ] Upgrading configuration in progress.
10-04 20:02:39.391 30572 31073 I python : [INFO ] [Logger ] Record log in /data/user/0/org.test.audiotest/files/app/.kivy/logs/kivy_21-10-04_0.txt
10-04 20:02:39.392 30572 31073 I python : [INFO ] [Kivy ] v2.0.0
10-04 20:02:39.392 30572 31073 I python : [INFO ] [Kivy ] Installed at "/data/user/0/org.test.audiotest/files/app/_python_bundle/site-packages/kivy/__init__.pyc"
10-04 20:02:39.392 30572 31073 I python : [INFO ] [Python ] v3.8.9 (default, Oct 4 2021, 19:42:43)
10-04 20:02:39.392 30572 31073 I python : [Clang 8.0.2 (https://android.googlesource.com/toolchain/clang 40173bab62ec7462
10-04 20:02:39.392 30572 31073 I python : [INFO ] [Python ] Interpreter at ""
10-04 20:02:39.398 30572 31073 I python : [INFO ] [Factory ] 186 symbols loaded
10-04 20:02:40.832 30572 31073 I python : [INFO ] [SoundFFPy ] Using ffpyplayer 4.3.2
10-04 20:02:40.833 30572 31073 I python : [INFO ] [Audio ] Providers: audio_ffpyplayer (audio_android, audio_sdl2 ignored)
10-04 20:02:40.873 30572 31073 I python : [INFO ] [ImageLoaderFFPy] Using ffpyplayer 4.3.2
10-04 20:02:40.873 30572 31073 I python : [INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_ffpyplayer (img_pil ignored)
10-04 20:02:40.897 30572 31073 I python : [WARNING] [Audio ] Unable to find a loader for </data/data/org.test.audiotest/files/app/music/10_poker_face.mp3>
10-04 20:02:40.907 30572 31073 I python : [INFO ] [Text ] Provider: sdl2
10-04 20:02:41.053 30572 31073 I python : [INFO ] [Window ] Provider: sdl2
10-04 20:02:41.078 30572 31073 I python : [INFO ] [GL ] Using the "OpenGL ES 2" graphics system
10-04 20:02:41.079 30572 31073 I python : [INFO ] [GL ] Backend used <sdl2>
10-04 20:02:41.079 30572 31073 I python : [INFO ] [GL ] OpenGL version <b'OpenGL ES 3.2 v1.r22p0-01rel0.44b5f76694af1b9bc2767a12e28349a5'>
10-04 20:02:41.080 30572 31073 I python : [INFO ] [GL ] OpenGL vendor <b'ARM'>
10-04 20:02:41.080 30572 31073 I python : [INFO ] [GL ] OpenGL renderer <b'Mali-T880'>
10-04 20:02:41.080 30572 31073 I python : [INFO ] [GL ] OpenGL parsed version: 3, 2
10-04 20:02:41.080 30572 31073 I python : [INFO ] [GL ] Texture max size <8192>
10-04 20:02:41.080 30572 31073 I python : [INFO ] [GL ] Texture max units <16>
10-04 20:02:41.110 30572 31073 I python : [INFO ] [Window ] auto add sdl2 input provider
10-04 20:02:41.111 30572 31073 I python : [INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
10-04 20:02:41.115 30572 31073 I python : [WARNING] [Base ] Unknown <android> provider
10-04 20:02:41.116 30572 31073 I python : [INFO ] [Base ] Start application main loop
10-04 20:02:41.118 30572 31073 I python : [INFO ] [GL ] NPOT texture support is available
10-04 20:03:06.259 30572 31073 I python : Couldn't play song, Song value: None
10-04 20:03:07.042 30572 31073 I python : Couldn't play song, Song value: None
10-04 20:03:07.547 30572 31073 I python : Couldn't play song, Song value: None
My main python file:
import os
# Ensure that the audio provider is `ffpyplayer` across all platforms
os.environ["KIVY_AUDIO"] = "ffpyplayer"
from kivy.lang import Builder
from kivy.core.audio import SoundLoader
from kivy.app import App
class MainApp(App):
def __init__(self, **kwargs):
super(MainApp, self).__init__(**kwargs)
self.song = SoundLoader.load("music/10_poker_face.mp3")
self.kv = Builder.load_string('''
#:kivy 2.0.0
Button:
text: "Play | Stop song!"
size_hint: (.7, .7)
pos_hint: {"center_x": .5, "center_y": .5}
on_release: app.play_song()
''')
def build(self):
return self.kv
def play_song(self):
if self.song:
if self.song.state == "play":
self.song.stop()
else:
self.song.play()
else:
print("Couldn't play song, Song value:", self.song)
if __name__ == '__main__':
MainApp().run()
The lines I have changed in the buildozer.spec file:
# (str) Title of your application
title = AudioTest
# (str) Package name
package.name = audiotest
# (str) Package domain (needed for android/ios packaging)
package.domain = org.test
# (str) Source code where the main.py live
source.dir = .
# (list) Source files to include (let empty to include all the files)
source.include_exts = py,png,jpg,kv,atlas,mp3
# (list) List of inclusions using pattern matching
source.include_patterns = music/10_poker_face.mp3,
# (list) Application requirements
# comma separated e.g. requirements = sqlite3,kivy
requirements = python3,kivy==2.0.0,ffpyplayer
# (str) Android logcat filters to use
android.logcat_filters = *:S python:D
My entire buildozer.spec file: buildozer.spec