Audio doesn't work on Android 4.2

0 favourites
  • 10 posts
From the Asset Store
100+ Musical High Quality Sound Effects for your game!
  • I need to build apk for an old Android 4.2, I managed to do this by changing "android-minSdkVersion" to 17 and building with Cordova CLI.

    When I'm testing it on an old phone, everything works except for sounds and music. Logcat shows errors like this:

    I'm guessing .ogg format is unsupported, or maybe it's looking for the media file in wrong location..

    Does anyone knows how to fix this? Is it possible to use wav or mp3 without conversion to ogg somehow? Will appreciate any advice.

    .

    EDIT: Seems like some issue with file access or location. Same error happens when I try playing mp3 or any other file.

    Tagged:

  • The issue is related to wkwebview and the way it accesses app resources. I can play any sound from internal phone storage or sdcard, but not from the apk.

    I sort of found a solution, it's not great but it works - I can encode sounds in base64 strings and play them using Base64 Audio plugin. I'll have to remove music because the files will be huge, but at least I'll have short sounds in my game.

  • I wonder why cordova based apk worked at all at Android 4.2. That time crosswalk was necessary. Before 4.4 it wasn't really working.

  • Asmodean Oh, I actually haven't tested on 4.2, my phone has version 4.4.4

    Are you saying it won't work on 4.2?

    Do you know if I can build an app with crosswalk plugin? I can export my project from an older version of C2, but I'm getting this error when trying to build with Cordova:

    Phonegap build also fails with some similar error about plugins.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Before Android 4.4 it doesn't used the chrome engine and it didn't worked very well and it was a part of Android until Android 5. So all WebView versions before 5 are completely outdated.

    I don't know if PhoneGap still supports crosswalk. I used Intel_XDK that time but that doesn't exist anymore. Maybe with Cordova CLI you can compile to crosswalk.

  • Asmodean Thanks for the info!

    I managed to build it with Phonegap, had to update targetSDKversion. The apk size is enormous! But I guess it's expected with crosswalk. Tested on x86 emulator with Android 4.2 and audio works, but it crashes on arm emulator...

  • dop2000 wasn't there two apks generated with crosswalk? I think if you build an APK with Corsswalk there were always two builds. One for X86 on for ARM.

  • Yeah, but each build is still ~28MB. The project size is only 800KB.

  • Because it's your project exported to html + chrome browser.

    The ARM build crashes on the ARM Emulator?

  • Yeah, the app launches and then closes after a few seconds. I don't know if it's an emulator issue, the ARM emulator is terribly slow.

    x86 build works in x86 emulator, and ARM build works on my Android 4.4 phone, so I guess it's a good sign. I'll try to find someone with an Android 4.2 device to test.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)