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

你说的曾经没有我的故事 提交于 2019-11-28 13:42:48

ContextCompat.checkSelfPermission() requires support library in version 23 or higher.

Add in dependencies block in lower-level build.gradle:

compile 'com.android.support:appcompat-v7:23.1.1' 

If you have previous version here (which you probably have), you should replace lane with provided by me.

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.

You can set target android of your project to android 6.0 or higher. Then add android-support-v4.jar

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