在 xml 文件中,我有以下代码。我可以通过单击 ringtonepref 屏幕中的广告铃声按钮来选择 mp3 声音,但是当我这样做时,我看到以下异常。这以前可以工作,但在更新到 android 8 之后就不能工作了。
怎么能
<RingtonePreference
android:defaultValue="content://settings/system/notification_sound"
android:key="ringtone_pref"
android:ringtoneType="all"
android:title="@string/hr_beep_tone_title"
android:summary="@string/hr_beep_tone_summary"/>
01-17 00:21:15.785 15503-16432/? E/RingtonePickerActivity: Unable to add new ringtone
java.lang.IllegalArgumentException: Unsupported ringtone type: 7
at android.media.RingtoneManager.getExternalDirectoryForType(RingtoneManager.java:1088)
at android.media.RingtoneManager.addCustomExternalRingtone(RingtoneManager.java:1056)
at com.android.providers.media.RingtonePickerActivity$2.doInBackground(RingtonePickerActivity.java:281)
at com.android.providers.media.RingtonePickerActivity$2.doInBackground(RingtonePickerActivity.java:278)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)