Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

class file for android.security.identity.IdentityCredential not found

As part of authentication in my app, I am trying to implement biometric authentication.

I did the required code changes as per documentation.

When building my application, I am facing the below build error.

class file for android.security.identity.IdentityCredential not found

Please find the build.gradle file below.

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    defaultConfig {
        applicationId "com.vj.togetheron"
        minSdkVersion 23
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {


    //implementation "androidx.security:security-crypto:1.0.0-rc03"

    // For Identity Credential APIs
    //implementation "androidx.security:security-identity-credential:1.0.0-alpha01"
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    //noinspection GradleCompatible
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.google.android.material:material:1.2.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'androidx.biometric:biometric:1.1.0-beta01'
    implementation 'androidx.legacy:legacy-support-core-utils:1.0.0'
    //implementation "androidx.security:security-identity-credential:1.0.0-alpha01"
    //implementation 'androidx.security:security-crypto:1.1.0-alpha02'
    testImplementation 'junit:junit:4.13.1'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}

Please anyone inform what I am missing here?

like image 599
vjr Avatar asked Jun 07 '26 10:06

vjr


1 Answers

android.security.identity.IdentityCredential is available only starting from API level 30.

I've been able to resolve this error by setting compileSdkVersion 30 in build.gradle for my main project and all libraries which are compiled from sources.

For some unknown reason when I set "compileSdkVersion 30" for the main project but one library still contains "compileSdkVersion 29" in its build.gradle, the android-29 sdk path is used for compiling the main project. :(

like image 79
Jusid Avatar answered Jun 10 '26 05:06

Jusid



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!