AndroidAttribute Compatibility in Android API lower than Lollipop.
See original GitHub issueIssue details
Running LibGDX project in Android 4.4.2 (and possibly all APIs lower than Lollipop) produces error:
04-27 14:55:43.157 7183-7183/com.mygdx.test442 E/dalvikvm: Could not find class 'android.media.AudioAttributes$Builder', referenced from method com.badlogic.gdx.backends.android.AndroidAudio.<init>
I googled it and possibly found solution. This answer explains why this error is popping up. I didn’t get it properly but I know you guys are the masterminds here.
Reproduction of issue
Running LibGDX project in Android 4.4.2? Error is produced from LibGDX package class AndroidAudio. I thought it might be related to my code so to verify I created a new GDX project and ran the apk wihthout changing a single word. It works fine but logcat in Android Studio shows the same error.
Version of LibGDX and/or relevant dependencies
LibGDX version : 1.9.10
Stacktrace
04-27 14:55:43.157 7183-7183/com.mygdx.test442 E/dalvikvm: Could not find class 'android.media.AudioAttributes$Builder', referenced from method com.badlogic.gdx.backends.android.AndroidAudio.<init>
Please select the affected platforms
- Android
- iOS (robovm)
- iOS (MOE)
- HTML/GWT
- Windows
- Linux
- MacOS
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (5 by maintainers)
Top GitHub Comments
I ran the AudioDeviceTest on an Android 4.0.4 emulator and I get also the error, but I can hear the annoying tone (which it should produce), too. Do you have the actual problem that audio is not played? Or is this only a hint that there could be a problem? @decepticlown Because if everything is working, in my opinion we shouldn’t change anything for the decreasing group of Android 4 users.
I think the short answer is “it’s complicated”, but the longer answer seems to be described here: https://stackoverflow.com/a/30262940/416549
So, no, reflection appears not to be needed, but some sort of encapsulating class is.