在使用Marshmallow 6.0运行应用程序期间发生了错误getslotfrombufferlocked。我想在Marshmallow 6.0上运行我的应用程序。请指导我。
build.gradle文件如下:
apply plugin:'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.project.myproject"
minSdkVersion 8
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions{
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.1.1'
compile files('libs/httpclient-4.4.1.jar')
compile files('libs/httpcore-4.4.1.jar')
}
错误是:
07-17 20:02:42.490 1457-4496/? E/Surface: getSlotFromBufferLocked: unknown buffer: 0x7fa11a5b20
07-17 20:02:45.282 21549-21586/com.project.myproject E/Surface: getSlotFromBufferLocked: unknown buffer: 0x7f8cc5a1a0
07-17 20:02:46.995 21549-21586/com.project.myproject E/Surface: getSlotFromBufferLocked: unknown buffer: 0x7f8cc5a240
07-17 20:02:54.920 21549-21586/com.project.myproject E/Surface: getSlotFromBufferLocked: unknown buffer: 0x7f8cc56d20
07-17 20:03:01.793 1457-4496/? E/Surface: getSlotFromBufferLocked: unknown buffer: 0x7f8796a780
答案 0 :(得分:0)
我的登录活动如下:
package com.project.myproject;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class loginActivity extends AppCompatActivity {
Button login,forg,use;
EditText uid ,pass ;
TextView tv ;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
login=(Button)findViewById(R.id.login);
forg=(Button)findViewById(R.id.forg);
use=(Button)findViewById(R.id.use);
uid=(EditText) findViewById(R.id.uid);
pass=(EditText) findViewById(R.id.pass);
tv=(TextView) findViewById(R.id.textView2);
login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String u = uid.getText().toString();
String p = pass.getText().toString();
if(u.isEmpty()|| p.isEmpty())
{
tv.setText("PROVIDE VALUE");
tv.setTextColor(Color.RED);
tv.setTextSize(30);
}
else {
Intent i2=getIntent();
String type=i2.getStringExtra("type");
if (u.equals(p) && (type != "Faculty")) {
Intent i = new Intent(loginActivity.this, studentLoginActivity.class);
//i.putExtra("uid",u);
startActivity(i);
}
else if(u.equals(p) && (type != "Student")) {
Intent i = new Intent(loginActivity.this, facultyLoginActivity.class);
//i.putExtra("uid",u);
startActivity(i);
}
else {
tv.setText("Login Failed");
tv.setTextColor(Color.RED);
tv.setTextSize(30);
}
}
}
});
forg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i1=new Intent(loginActivity.this,forgetPasswordActivity.class);
startActivity(i1);
}
});
use.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i2=new Intent(loginActivity.this,newUserActivity.class);
startActivity(i2);
}
});
}
}
当我从登录活动转到新用户活动时,发生了getslotfrombufferlocked,我的新用户活动代码如下:
package com.project.myproject;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
public class newUserActivity extends AppCompatActivity {
private ProgressDialog pDialog;
JSONParser jsonParser = new JSONParser();
EditText uid, pass, ans, con;
Spinner sp1, sp2;
public String[] type = {"Select type", "Faculty", "Student"};
//String passw,cpass,answ,spin1,spin2;
//int id1;
private static String url_insertion = "http://localhost/insertion.php";
private static final String TAG_SUCCESS = "success";
Button reg;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_new_user);
Intent i2 = getIntent();
Intent i5 = new Intent(getApplicationContext(), loginActivity.class);
i5.putExtra("type", type);
//startActivity(i5);
uid = (EditText) findViewById(R.id.uid);
pass = (EditText) findViewById(R.id.pass);
ans = (EditText) findViewById(R.id.ans);
con = (EditText) findViewById(R.id.con);
sp1 = (Spinner) findViewById(R.id.spinner3);
sp2 = (Spinner) findViewById(R.id.spinner2);
Button reg = (Button) findViewById(R.id.reg);
String[] quest = {"Select Question", "What is your pet's name", "What is your favorite color", "What is the place do you like most", "Which is your favorite book"};
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item, quest);
sp1.setAdapter(adapter);
sp1.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (position == 0) {
} else {
Toast.makeText(newUserActivity.this, "You Have Selected" + sp1.getSelectedItem(), Toast.LENGTH_SHORT).show();
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
ArrayAdapter<String> adapter1 = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item, type);
sp2.setAdapter(adapter1);
sp2.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (position == 0) {
} else {
Toast.makeText(newUserActivity.this, "You Have Selected" + sp2.getSelectedItem(), Toast.LENGTH_SHORT).show();
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
reg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
int ID = Integer.parseInt(uid.getText().toString());
String Password = pass.getText().toString();
String Question = sp1.getAdapter().toString();
String Answer = ans.getText().toString();
String Type = sp2.getAdapter().toString();
new BackgroundTask().execute(ID,Password,Question,Answer,Type);
}
});
}
class BackgroundTask extends AsyncTask<String, String, String> {
private ProgressDialog pDialog;
@Override
protected void onPreExecute() {
super.onPreExecute();
pDialog = new ProgressDialog(newUserActivity.this);
pDialog.setMessage("Creating Account...");
pDialog.setIndeterminate(false);
pDialog.setCancelable(true);
pDialog.show();
}
@Override
protected String doInBackground(String... args){
String ID = String.valueOf(Integer.parseInt(args[0]));
String Password = args[1];
String Question = args[2];
String Answer = args[3];
String Type = args[4];
List<NameValuePair>params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("ID",ID));
params.add(new BasicNameValuePair("Password",Password));
params.add(new BasicNameValuePair("Question",Question));
params.add(new BasicNameValuePair("Answer",Answer));
params.add(new BasicNameValuePair("Type",Type));
JSONObject json = jsonParser.makeHttpRequest(url_insertion,"POST",params);
Log.d("Create Response",json.toString());
try{
int success = json.getInt(TAG_SUCCESS);
if(success==1) {
Intent i = new Intent(getApplicationContext(),loginActivity.class);
startActivity(i);
finish();
} else {
}
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
protected void onPostExecute(String file_url) {
pDialog.dismiss();
}
public void execute(int id, String password, String question, String answer, String type) {
}
}
}
请给我答案解决它。