question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AndroidAttribute Compatibility in Android API lower than Lollipop.

See original GitHub issue

Issue 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:closed
  • Created 3 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
SimonITcommented, Apr 30, 2020

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.

2reactions
MobiDevelopcommented, Apr 30, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Compatibility framework changes (Android 12)
This page describes each behavior change that is part of the compatibility framework in Android 12 (API level 31). Use this list in...
Read more >
Android API Level, backward and forward compatibility - Medium
Android API Level, backward and forward compatibility. If you get to read this article it might mean you are wondering things like: What...
Read more >
Changelog for Android and FireOS - Braze
The Android SDK has now fully migrated to AndroidX dependencies. No backwards compatibility is possible with the no longer maintained Android Support ...
Read more >
Understanding Android API Levels - Xamarin | Microsoft Learn
Xamarin.Android has several Android API level settings that determine your app's compatibility with multiple versions of Android.
Read more >
Get Android API level of phone currently running my application
If you care about all versions possible (back to original Android version), as in minSdkVersion is set to anything less than 4, then...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found