Android studio getSlotFromBufferLocked: unknown buffer error

Edit:

This was a bug in Android that was fixed in later versions of Marshmallow

Original:

I believe that this is Marshmallow specific. Are you using a Marshmallow device?

I've noticed this error is printed out every time I switch between applications (doesn't matter which) or exit out of them, and when activities are destroyed.

I've tried running the same apps on two Nexus 5s - one running Lollipop and the other Marshmallow, and these log prints only appeared on the Marshmallow version - with every app, not just the one I'm building.

Not sure why this happens, but I opened a report here.


I think you are finishing the context before backgrounTask finish, and Context you pass no longer exist.
You can try:

  • Use appContext : new BackgroundTask(Register.this.getApplicationContext());

  • Or, Wait for BackgroundTask finish : remove finish() after .execute(...) and add finish() onPostExecute


I don't have specific problem's solution. But I had similar problem. Anyone who has problem like this please make sure you have below code.

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

by using intelligence you might have choose below code:

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

This worked for me

For more info on PersistentState

Happy coding :)