Android Cannot resolve method 'checkSelfPermission' in 'ContextCompat'
时间: 2023-12-28 21:04:11 浏览: 71
android-support-v4-25.3.1-解决ContextCompat中不包含checkselfPermission
This error occurs when you try to use the `checkSelfPermission` method from the `ContextCompat` class in an Android project and Android Studio is unable to resolve the method.
To resolve this error, you need to make sure that you have the latest version of the `support-v4` library in your project. You can do this by adding the following line to your app's build.gradle file:
```gradle
implementation 'com.android.support:support-v4:28.0.0'
```
Once you have added this line, sync your project and try using the `checkSelfPermission` method again. It should now resolve correctly.
阅读全文