2016-07-17 71 views
0

錯誤getslotfrombufferlocked發生在使用Marshmallow 6.0的應用程序運行期間。我想在Marshmallow 6.0上運行我的應用程序。請引導我。GetSlotFromBufferLocked錯誤發生

應用插件: '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

請爲您的主要活動添加代碼,以便我們可以檢查並提出可能的解決方案。另外,請確認您的設備正在運行「Android 6.0.1」或更高版本。 – ishmaelMakitla

+0

我有Android 6.0而不是6.0.1,所以我該如何解決這個問題?我的主要活動如下: – A10

+0

感謝您的更新 - 順便說一句,您應該將它添加到您的問題,而不是作爲答案發布。 – ishmaelMakitla

回答

0

我登錄活動給予

該文件的build.gradle下面給出如下:

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) { 
     } 
    } 
} 

請給我回答解決這個問題。

+0

您可以在'doInBackground'註釋掉你開始活動的代碼 - 註釋行'startActivity(i);'和它下面的行:'finish();' - 然後嘗試運行應用程序再次。讓我知道接下來會發生什麼。我懷疑這可能是造成這個問題的原因。 – ishmaelMakitla

+0

@ishmaelMakitla在執行我的應用程序期間,我再次發現相同的錯誤, ,getslotfrombufferlocked – A10

+0

即使按照我的建議進行更改?你能不能粘貼整個錯誤日誌?也許有跡象表明,哪一行會導致這種情況 - 但我懷疑它可能與你在'doInBackground'中的代碼有關 - 所以可能會將大部分代碼註釋掉(特別是'try-catch'塊)和看看錯誤如何消失。 – ishmaelMakitla