'Android error getSlotFromBufferLocked: unknown buffer: 0xa9fb8d90

i am working on an android app which uses material-intro dependencies for intro slides, but when the slide complete and try to switch from the Slide(MaterialintroActivity) to my main activity the app crashes.

LogCat

 07-26 12:42:19.566 897-944/com.naive.LISTY E/Surface: getSlotFromBufferLocked: unknown buffer: 0xa9fb8d90

AppManifest code

<application
    android:allowBackup="true"
    android:icon="@mipmap/icon"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MainIntroActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".MainActivity"/>
</application>

MainIntroActivity

public class MainIntroActivity extends IntroActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {

    setFullscreen(true);
    super.onCreate(savedInstanceState);

    addSlide(new SimpleSlide.Builder()
            .title(R.string.title)
            .description(R.string.description)
            .image(R.mipmap.ic_launcher)
            .background(R.color.background)
            .backgroundDark(R.color.background_dark)
            .buttonCtaClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v)
                {
                    Intent main=new Intent(MainIntroActivity.this, MainActivity.class);
                    startActivity(main);
                }
            })
            .build());
}}

MainActivity code

public class MainActivity extends AppCompatActivity {
private static final String TAG = "MainActivity";

private TaskDbHelper mHelper;
private ListView mTaskListView;
private ArrayAdapter<String> mAdapter;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    /*SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);

      if(!prefs.getBoolean("new1",false)){

        //Only 1st time run code here

        SharedPreferences.Editor editor = prefs.edit();
        editor.putBoolean("new1", true);
        editor.commit();
     }*/

    setContentView(R.layout.activity_main);
    mHelper = new TaskDbHelper(this);
    mTaskListView = (ListView) findViewById(R.id.list_todo);
    updateUI();
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.main_menu, menu);
    return super.onCreateOptionsMenu(menu);
}


@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.action_add_task:

        final EditText taskEditText = new EditText(this);
        AlertDialog dialog = new AlertDialog.Builder(this)
                .setTitle("Add new task")
               // .setMessage("What do you want to do next?")
                .setView(taskEditText)
                .setPositiveButton("Add", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        String task = String.valueOf(taskEditText.getText());
                        if(task != null && !task.isEmpty()) {
                            SQLiteDatabase db = mHelper.getWritableDatabase();
                            ContentValues values = new ContentValues();
                            values.put(TaskContract.TaskEntry.COL_TASK_TITLE, task);
                            db.insertWithOnConflict(TaskContract.TaskEntry.TABLE,
                                    null,
                                    values,
                                    SQLiteDatabase.CONFLICT_REPLACE);
                            updateUI();
                            db.close();
                        } else {

                        }
                    }
                })
                .setNegativeButton("Cancel", null)
                .create();
        dialog.show();

        default:
            return super.onOptionsItemSelected(item);
    }
}

private void updateUI() {
    ArrayList<String> taskList = new ArrayList<>();
    SQLiteDatabase db = mHelper.getReadableDatabase();
    Cursor cursor = db.query(TaskContract.TaskEntry.TABLE,
            new String[]{TaskContract.TaskEntry._ID, TaskContract.TaskEntry.COL_TASK_TITLE},
            null, null, null, null, null);
    while (cursor.moveToNext()) {
        int idx = cursor.getColumnIndex(TaskContract.TaskEntry.COL_TASK_TITLE);
        taskList.add(cursor.getString(idx));
    }

    if (mAdapter == null) {
        mAdapter = new ArrayAdapter<>(this,
                R.layout.item_todo,
                R.id.task_title,
                taskList);
        mTaskListView.setAdapter(mAdapter);
    } else {
        mAdapter.clear();
        mAdapter.addAll(taskList);
        mAdapter.notifyDataSetChanged();
    }

    cursor.close();
    db.close();
}

public void deleteTask(View view) {
    View parent = (View) view.getParent();
    TextView taskTextView = (TextView) parent.findViewById(R.id.task_title);
    String task = String.valueOf(taskTextView.getText());
    SQLiteDatabase db = mHelper.getWritableDatabase();
    db.delete(TaskContract.TaskEntry.TABLE,
            TaskContract.TaskEntry.COL_TASK_TITLE + " = ?",
            new String[]{task});
    db.close();
    updateUI();
}
}


Solution 1:[1]

Are you testing with marshmallow version ? cause i found that issue : https://code.google.com/p/android/issues/detail?id=192357

can u try to change oncreate function from :

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.<YOUR_XML_FILE_NAME>);

To this :

@Override
public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
    super.onCreate(savedInstanceState, persistentState);
    setContentView(R.layout.<YOUR_XML_FILE_NAME>);
}

if the problem persist try to update your android version its an issues in Android 6.0.1 . hope it help .

Solution 2:[2]

In my case, the error is hapened after changed minSdkver from 9 to 16 in the appmaniefest. I did undo minsdk version change. It is solved the error. Originally I was trying to use the calendar and date which request at least min version 16.

Solution 3:[3]

Restart Android Studio and your Emulator. It will work after restart.

Solution 4:[4]

<application
    android:allowBackup="true"
    android:icon="@mipmap/icon"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MainIntroActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".MainActivity"/>
</application>

Solution 5:[5]

Added internet permission

<?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.projectx.store">

        <uses-permission android:name="android.permission.INTERNET" />

        <application
            android:allowBackup="true"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:roundIcon="@mipmap/ic_launcher_round"
            android:supportsRtl="true"
            android:theme="@style/AppTheme">
            <activity android:name=".MainActivity">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />

                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
            <activity android:name=".ViewAllStore" />
            <activity android:name=".ViewStore"></activity>
        </application>

    </manifest>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 MedAmine.Rihane
Solution 2
Solution 3 Emre AYDIN
Solution 4 19adonis25
Solution 5 Narendra Singh