No Sound - "Maroon In Trouble" app on Android x86 (GCC 4.9, Qt 5.6.0)
-
I am trying to run the sample app, "Maroon In Trouble".
But unfortunately this app does not play sound when run on Android Kit Kat (x86). What am I missing?My Platform is Android 4.4.4 on x86, Linux 3.10.20 (gcc ver. 4.7)
Built for Android SDK "android-19",
Using the Qt Creator 5.6.0 release, along with all the pre-packaged distribution of tools; GCC 4.9, etc. , I can build and deploy "Maroon in Trouble" to my Android device successfully, it runs (fish float & move), but sound does not work. I can also build and deploy the same project using VS2013 for the Win32 platform and fish float along with the addition of sound. It works.I did notice the following:
- In the .pro file there is no QTPLUGIN += (should there be?)
- There is a qtHaveModule(multimedia): QT+= multimedia (which should add multimedia support files?)
- I have not modified the .pro or .qml source files, they are as distributed.
- I do see an errors logged during application runtime (java class android.graphics.drawable.RippleDrawable is missing exceptions, etc.), but the one that really bothers me the most is:
W/libmaroon(27239): qrc:///demos/maroon/content/SoundEffect.qml:45 ((null)): qrc:///demos/maroon/content/SoundEffect.qml:45: Error: Qt.createQmlObject(): failed to create object:
W/libmaroon(27239): qrc:///demos/maroon/content/inline:1:1: module "QtMultimedia" is not installedAlso, not sure what I should see, but the "Audio Devices" sample app can "output" to the "default" device, using the "audio/pcm" at various frequencies/settings, I see "Success" always returned. The AudioOutput sample can output a tone too. It's appears that QSoundEffect has an issue &/or multimedia is not installed/deployed for some reason on this platform?
Also, the device is not rooted, so I am not sure if I should see pulseaudio or ALSA installed/running. There doesn't appear to be pactrl or pulseaudio installed or running (but other apps/games that use sound don't seem to have sound issues).
I'm also having similar issues with my own app trying to using QSoundEffect.
-
This appears to be a QT Android deployment issue.
It also looks like some sample apps are hard coded to particular Qt release?The following is what I did to fix sound for the Maroon sample app (a QtQuick/QML app) on Qt 5.6 for Android x86.
The fix for: "Maroon In Trouble".
Modified the resource: SoundEffect.qml:
Added (missing!?):
import QtMultimedia 5.6Modified the following line, changing the library from 5.0 to 5.6:
property QtObject effect: Qt.createQmlObject("import QtMultimedia 5.6; SoundEffect{ source: '" + container.source + "'; muted: !Qt.application.active }", container);Applying the above changes added one additional library to the Android plugin/lib directory
...android-build\libs\x86\*.so -> libqml_QtMultimedia_libdeclarative_multimedia.soNote: libplugins_audio_libqtaudio_opensles.so was present in: ...android-build\libs\x86\ before I added the import statement, but this library may not have been actually deployed? (hence the log message "QtMultimedia" is not installed)
Note: It appears that 5 additional dependencies from Qt are reported to be added to the package.
It appears that it is not enough to have an entry in the *.pro for qtHaveModule(multimedia): QT += multimedia as the Qt sound libraries are not deployed? I think adding the import statement probably changed what was actually deployed, but someone better informed about apk's & how deployment works can probably explain this better.
Now I need to understand how to do the equivalent deployment fix for my C++ app. Does anyone know the equivalent to the above "import" statement?, to ensure that ALL the multimedia files libraries/plugins are deployed? As I think I am running into the very same issue. Where does one put the import statement in a C++ app?
Thanks in advance!
Jake