Android IDE (AIDE) Support Forum

ContextCompat and ActivityCompat are being shown as Unknown entity

I have the following code

if (ContextCompat.checkSelfPermission(this,
Manifest.permission.SEND_SMS)
!= PackageManager.PERMISSION_GRANTED) {
if (ActivityCompat.shouldShowRequestPermissionRationale(this,
Manifest.permission.SEND_SMS)) {
} else {
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.SEND_SMS},
MY_PERMISSIONS_REQUEST_SEND_SMS);
}
}

But AIDE is showing unknown entity for ContextCompat and ActivityCompat.

Please help me in this regard and oblige me there by.

Thanks.

You need to actually add the support library to your project and add the dependency search the forum for more info and probably a walkthrough.

1 Like

Not sure, but maybe AIDE mate addresses this issue.

Add the following line to the “dependencies” section of the project’s “gradle.build” file.

compile ‘com.android.support:appcompat-v7:25.3.1’

Then (Build) run the project. After the question about download, select yes and then fix Error

Sample
gradle.build

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.0"

defaultConfig {
    applicationId "com.company.app"
    minSdkVersion 14
    targetSdkVersion 29
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.3.1'
}