首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在我的代码没有改变的情况下,获取"Android资源链接失败“

在我的代码没有改变的情况下,获取"Android资源链接失败“
EN

Stack Overflow用户
提问于 2021-11-14 23:06:58
回答 1查看 427关注 0票数 1

最近,我在运行我的应用程序时遇到了这个错误:

代码语言:javascript
复制
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Android resource linking failed
     C:\Users\Ved\.gradle\caches\transforms-2\files-2.1\17b6ef056be36c409382a0a8037faedc\core-1.7.0\res\values\values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar not found.

和:

代码语言:javascript
复制
Android resource linking failed
C:\Users\Ved\.gradle\caches\transforms-2\files-2.1\17b6ef056be36c409382a0a8037faedc\core-1.7.0\res\values\values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar not found.

当我单击它时,它会将我带到values.xml第150行:

代码语言:javascript
复制
<declare-styleable name="ColorStateListItem">
        <!-- Base color for this state. -->
        <attr name="android:color"/>
        <!-- Alpha multiplier applied to the base color. -->
        <attr format="float" name="alpha"/>
        <attr name="android:alpha"/>
        <!-- Perceptual luminance applied to the base color. From 0 to 100. -->
        <attr format="float" name="lStar"/>
        <attr name="android:lStar"/>
    </declare-styleable>

我甚至没有使用这个样式,但是错误仍然存在。我读过一些文章,讨论我的compileSDKandroid-core:core-ktx:+的问题,但是当我把SDK改为31和android-core:core-ktx:1.7.0时,它仍然不能工作,并给了我另一个错误。我一直在努力寻找答案,但我一直无法找到答案,希望你们中的一个人能找到答案。下面是我的构建步骤:

代码语言:javascript
复制
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
    compileSdkVersion 29

    defaultConfig {
        applicationId "com.suad.venttome"
        minSdkVersion 15
        targetSdkVersion 29
        versionCode 6
        versionName "1.5"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.2.1'
    implementation 'com.google.android.material:material:1.2.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.core:core:1.3.2'
    testImplementation 'junit:junit:4.13'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    implementation 'com.google.android.material:material:1.3.0-alpha04'
    implementation 'com.jjoe64:graphview:4.2.2'
    implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'

    //Passcode view
    implementation 'com.hanks:passcodeview:0.1.2'

    //Material.io implementation
    implementation 'com.google.android.material:material:1.2.0-alpha04'


    //Android Jetpack Navigation
    def nav_version = "2.3.2"
    implementation "androidx.navigation:navigation-fragment:$nav_version"
    implementation "androidx.navigation:navigation-ui:$nav_version"
    implementation "androidx.core:core-ktx:+"
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
repositories {
    maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
    mavenCentral()
}

和:

代码语言:javascript
复制
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext.kotlin_version = '1.4.30-M1'
    repositories {
        google()
        jcenter()
        maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.0.0"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

如果你有一个可行的解决方案,我很乐意给她。提前感谢!

EN

回答 1

Stack Overflow用户

发布于 2021-11-15 08:20:06

只要改变就好

代码语言:javascript
复制
implementation "androidx.core:core-ktx:+"

代码语言:javascript
复制
implementation "androidx.core:core-ktx:1.6.0"

对于1.7.0版本,它也不适用于我

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69967918

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档