when applying for permission,
Error: (29427) error: cannot find symbol
symbol: method requestPermissions (MainActivity,String [], int)
location: class ActivityCompat
after checking, it may be a problem with v4 package. I tried to modify the compiled version of gradle, but it didn"t work.
Code:
private void checkPermissions (String [] needPermissions) {
//
List<String> needRequestPermissonList = findDeniedPermissions(needPermissions);
if (null != needRequestPermissonList
&& needRequestPermissonList.size() > 0) {
//list.toarray
ActivityCompat.requestPermissions(this, needRequestPermissonList.toArray(new String[needRequestPermissonList.size()]),
PERMISSON_REQUESTCODE);
}
}
dependency section of gradle:
dependencies {
implementation fileTree(include: ["*.jar"], dir: "libs")
//noinspection GradleCompatible
implementation "com.android.support:appcompat-v7:26.0.0-beta1"
implementation "com.android.support.constraint:constraint-layout:1.0.2"
testImplementation "junit:junit:4.12"
androidTestImplementation "com.android.support.test:runner:0.5"
androidTestImplementation "com.android.support.test.espresso:espresso-core:2.2.2"
compile "com.android.support:recyclerview-v7:26.0.0-alpha1"
compile "com.squareup.okhttp:okhttp:2.7.5"
compile "com.google.code.gson:gson:2.2.4"
compile "com.squareup.okhttp3:okhttp:3.4.2"
compile "com.zhy:autolayout:1.4.5"
compile "com.tencent.mm.opensdk:wechat-sdk-android-with-mta:+"
compile "com.youth.banner:banner:1.4.10"
compile "org.greenrobot:eventbus:3.1.1"
compile "com.github.bumptech.glide:glide:3.7.0"
compile "com.github.PhilJay:MPAndroidChart:v3.0.0-beta1"
compile "com.aliyun.dpa:oss-android-sdk:2.8.0"
compile "com.lzy.widget:imagepicker:0.6.1"
compile "com.xingliuhua:xlhratingbar_lib:1.0.1"
compile "com.tencent.mm.opensdk:wechat-sdk-android-with-mta:+"
compile "com.kyleduo.switchbutton:library:1.4.4"
compile "org.quanqi:CircularProgress:1.0.2"
compile "com.zhy:okhttputils:2.6.2"
compile "cn.aigestudio.wheelpicker:WheelPicker:1.1.2"
}
what should I do now to avoid this problem?