java.lang.StackOverflowError:堆栈大小8MB检查权限时出错

时间:2017-05-25 07:42:39

标签: java android

此堆栈大小错误仅在某些设备中出现。

public void configureLocation() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
       //Error occurs in the following line 
if (ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
            requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.INTERNET}, 10);
        } else {
            requestLocationUpdate();
        }
    } else {
        requestLocationUpdate();
    }
}

java.lang.StackOverflowError: stack size 8MB
at android.app.ActivityManagerNative.getDefault(ActivityManagerNative.java:97)
at android.app.ContextImpl.checkPermission(ContextImpl.java:1644)
at android.content.ContextWrapper.checkPermission(ContextWrapper.java:721)
at android.support.v4.content.b.a(ContextCompat.java:432)
at com.kawasolutions.Kawa.d.a.d.R(MainFragment.java:326)
at com.kawasolutions.Kawa.d.a.d.a(MainFragment.java:569)

函数'configureLocation'仅在活动中调用一次。

0 个答案:

没有答案