The method checkSelfPermission(Context, String) is undefined for the type ContextCompat

前端 未结 3 1454
余生分开走
余生分开走 2020-12-19 11:18
Context context;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
         


        
3条回答
  •  余生分开走
    2020-12-19 11:38

    This issue occurs because the support library is out of date.

    If you're using Eclipse, I've found the most simple solution is to right-click the project and go to:

    Android Tools > Add support library...

    If this doesn't resolve the issue, you probably need to update the SDK first:

    Window > Android SDK Manager > Install Updates

    The support library will be added/updated and will no longer show this error.

提交回复
热议问题