找不到android ContextCompat.checkSelfPermission() [英] android ContextCompat.checkSelfPermission() not found

查看:623
本文介绍了找不到android ContextCompat.checkSelfPermission()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使运行时权限与旧设备向后兼容,但是使用支持库,我无法在ContextCompat类中找到checkSelfPermission()静态调用,但是其文档记载为

I am trying to make runtime permissions backward compatible with older devices but using the support library i cant find checkSelfPermission() static call in ContextCompat class, but its documented here

这是我的项目Gradle设置:

Here is my project gradle settings:

defaultConfig {
    applicationId "org.myprogram.cool"
    minSdkVersion 16
    targetSdkVersion 23
    versionCode 39
    versionName "3.0"
}

这是依赖项:

compile 'com.google.android.gms:play-services:+'
compile 'com.squareup:otto:1.3.5'
compile 'com.android.support:appcompat-v7:22.1.1'

知道我想念什么吗?

推荐答案

如果您已从eclipse迁移,则添加以下行将不起作用

If you have migrated from eclipse adding the below line wont work

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

在迁移时,它将appcompatv4添加为外部依赖库. 确保已从libs文件夹中删除了appcompatv4库,然后它应该开始工作

While migrating, it adds appcompatv4 as an external dependent library. Make sure you have deleted the appcompatv4 library from the libs folder and then it should start working

这篇关于找不到android ContextCompat.checkSelfPermission()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆