列音频无效_id AS _id Android 11

问题描述

嗨,谷歌决定更新所有应用程序以针对 api30 音乐播放器,我正在使用停止在 Android 11 上工作 与 logcat 错误

'java.lang.IllegalArgumentException: Invalid column audio._id AS _id'

   private Cursor openCursorAndGoToFirst(Uri uri,String[] projection,String selection,String[] selectionArgs) {
        Cursor c = getContentResolver().query(uri,projection,selection,selectionArgs,null);
        if (c == null) {
            return null;
        }
        if (!c.movetoFirst()) {
            c.close();
            return null;
        }
        return c;
    }
private int getmCardId() {
        final ContentResolver resolver = getContentResolver();
        Cursor cursor = resolver.query(Uri.parse("content://media/external/fs_id"),null,null);
        int mCardId = -1;
        if (cursor != null && cursor.movetoFirst()) {
            mCardId = cursor.getInt(0);
            cursor.close();
            cursor = null;
        }
        return mCardId;
    }

有什么解决办法吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)