mSecurityInputMethodService is null in logcat

假装没事ソ 提交于 2019-12-31 13:05:24

问题


I wrote a little android app that should display the current location (last known location) of the smartphone. Although I copied the example code, and tried several other solutions, It seems to have the same error every time. My app consists of a button. Pressing the button should log the longitude and latitude, but only logs "mSecurityInputMethodService is null".

Here's the MainActivity.java:

public class MainActivity extends Activity {
int response;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Button button = (Button)findViewById(R.id.button);
    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            onbutclick();
        }
    });

}
public void onbutclick(){
    LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
    if(ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED){
        Location loc = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
        if(loc != null){
            Log.d("Latitude",Double.toString(loc.getLatitude()));
            Log.d("Longitude",Double.toString(loc.getLongitude()));
        }

    }else{
        ActivityCompat.requestPermissions(this,new String[] {Manifest.permission.ACCESS_FINE_LOCATION},response);
        Intent inte = getIntent();
        finish();
        startActivity(inte);
    }
}

I also used <uses-permission> in the Manifest file. I would really appreciate an explanation what does "mSecurityInputMethodService is null" really means.


回答1:


For my Huawei device the following helps:

Dial:

*#*#2846579#*#*

and a hidden menu is shown. Go to "Background Setting" -> "Log setting" and enable the log levels.




回答2:


Huawei Phones disable logcat, a small improvement on the above answer

Dial:

*#*#2846579#*#*

and a hidden menu is shown. Go to "Background Setting" -> "Log setting" and enable the log levels.

Specifically enable: AP Log, Charge Log and Sleep Log.

Source: https://www.xda-developers.com/huawei-phones-disable-logcat-heres-how-to-restore-access/




回答3:


I had the same error while accessing keyboard and the keyboard was not showing. And turning on log didn't help. It turns out i was using google keyboard and i switched to huawei swype and it was solved.



来源:https://stackoverflow.com/questions/38587844/msecurityinputmethodservice-is-null-in-logcat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!