【问题标题】:class file for android.security.identity.IdentityCredential not found找不到 android.security.identity.IdentityCredential 的类文件
【发布时间】:2021-02-20 04:13:00
【问题描述】:

作为我应用中身份验证的一部分,我正在尝试实施生物特征身份验证。

我根据文档进行了所需的代码更改。

在构建我的应用程序时,我遇到了以下构建错误。

找不到 android.security.identity.IdentityCredential 的类文件

请在下面找到 build.gradle 文件。

    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'
}

请任何人告诉我这里缺少什么?

【问题讨论】:

    标签: android build.gradle androidx android-biometric-prompt


    【解决方案1】:

    android.security.identity.IdentityCredential 仅从 API 级别 30 开始可用。

    我已经能够通过在build.gradle 中为我的主项目和从源代码编译的所有库 设置compileSdkVersion 30 来解决此错误。

    由于某些未知原因,当我为主项目设置“compileSdkVersion 30”但一个库在其 build.gradle 中仍包含“compileSdkVersion 29”时,android-29 sdk 路径用于编译主项目。 :(

    【讨论】:

    • 节省我的时间。谢谢
    猜你喜欢
    • 1970-01-01
    • 2021-10-08
    • 1970-01-01
    • 1970-01-01
    • 2022-06-29
    • 2023-01-12
    • 1970-01-01
    • 1970-01-01
    • 2017-12-10
    相关资源
    最近更新 更多