当前位置: 首页 > 知识库问答 >
问题:

获取Android资源链接失败

楚雪松
2023-03-14

我们正在构建一个android项目,当我们试图构建该项目时,我们得到了android资源构建失败

由于奇怪的原因,它指向一个不是我们项目的一部分的文件,该文件位于

C:\location.gradle\caches\transforms-2\files-2.1\87cdecd973dcf2cf22fdc9f513d1a506\roundkornerlayouts-0.4.0\res\values\values.xml:4:5-258:aapt:错误:资源attr/top_left_cerner_radius(又名com.package.android:attr/top_left_cerner_radius)找不到

我们不知道为什么这个错误会到来,背后的原因是什么!粘贴分级文件以了解更多详细信息

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.2.40'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.0'
        //classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.2.0'
        // 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" }
        maven {
            url 'https://github.com/psiegman/mvn-repo/raw/master/releases'
        }
        maven {
            url "http://dl.bintray.com/mobisystech/maven"
        }
    }
}

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

configurations.all {
    resolutionStrategy {
        force 'com.android.support:support-v4:27.1.0'
    }}

App build.gradle

buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/' }
    }
    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.11.0, 0.99.99]'
    }
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

repositories {
    maven { url 'https://maven.google.com' }
}


apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "in.studentkhabri.android"
        manifestPlaceholders = [onesignal_app_id               : 'hidden',
                                onesignal_google_project_number: 'REMOTE',
                                hostName                       : 'host_name'
        ]

        minSdkVersion 17
        targetSdkVersion 27
        versionCode 1
        multiDexEnabled true
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }


    compileOptions {
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.0'
    implementation 'com.android.support:design:27.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:multidex:1.0.1'
    implementation 'com.zsoltsafrany:needle:1.0.0'
    implementation 'com.google.code.gson:gson:2.2.4'
    implementation 'com.github.nihad92:SwipeableCards:1.0.19'
    implementation 'com.android.support:recyclerview-v7:27.1.0'
    implementation 'com.android.support:cardview-v7:27.1.0'
    implementation 'com.ncorti:slidetoact:0.5.1'
    implementation 'com.makeramen:roundedimageview:2.3.0'
    implementation 'com.mindorks.android:prdownloader:0.5.0'
    implementation 'net.bohush.geometricprogressview:geometricprogressview:1.1.1'
    implementation 'com.github.bumptech.glide:glide:4.8.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
    implementation 'com.onesignal:OneSignal:[3.9.1, 3.99.99]'
    implementation 'com.devbrackets.android:exomedia:4.3.0'
    //implementation 'com.dinuscxj:circleprogressbar:1.3.0'
    //implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever:1.0.14'
    implementation 'commons-io:commons-io:2.4'
    implementation 'com.facebook.android:audience-network-sdk:4.99.1'
    //implementation 'com.jaeger.statusbarutil:library:1.5.1'
    implementation 'com.github.iammert:MusicPlayerView:e3b937c729'
    implementation 'com.google.android.exoplayer:exoplayer:2.9.1'
    implementation 'com.google.android.exoplayer:extension-rtmp:2.9.1'
    implementation 'com.cleveroad:audiowidget:1.0.1'
    implementation 'jp.wasabeef:glide-transformations:4.0.1'
    implementation 'org.greenrobot:eventbus:3.1.1'
    implementation 'com.github.caneryilmaz:ZionFileDownloader:0.1.1'
    implementation 'org.jsoup:jsoup:1.11.3'
    implementation 'com.jcminarro:RoundKornerLayouts:0.4.0'
    implementation 'com.github.sujithkanna:smileyrating:1.6.8'
    implementation 'org.apache.commons:commons-lang3:3.0'
    //implementation 'com.github.mosamabinomar:AndroidEqualizer:1.0'
    //implementation 'com.ogaclejapan.smarttablayout:library:1.7.0@aar'
    implementation project(':ProgressDialog')
    implementation 'com.github.ixiDev:GDPRChecker:v0.2'
    implementation 'com.google.android.ads.consent:consent-library:1.0.3'
    implementation 'ru.tinkoff.scrollingpagerindicator:scrollingpagerindicator:1.0.6'
    implementation 'net.alexandroid.utils:exoplayerhelper:2.18'
    implementation 'com.google.firebase:firebase-ads:16.0.1'
    implementation 'com.google.firebase:firebase-core:16.0.9'
    implementation 'com.google.firebase:firebase-dynamic-links:16.1.7'

    implementation files('libs/YouTubeAndroidPlayerApi.jar')
}
apply plugin: 'com.google.gms.google-services'

configurations.all {
    resolutionStrategy {
        force 'com.android.support:support-v4:27.1.0'
    }}

共有1个答案

邵锐
2023-03-14

当Gradle在一个或多个XML文件中遇到错误(通常是语法或键入错误)时,该错误就会出现。

大多数XML文件位于res文件夹中,但是,您可能仍然可以在res文件夹之外找到一些文件。例如,位于“/src/main/androidmanifest.xml”中的Androidmanifest.xml。下面是一个布局文件的示例,它会给出“error:failed linking file resources”错误。

<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
    <gradient
        android:angle="90"
        android:centerColor="@color/colorPrimaryDark"
        android:endColor="@color/colorPrimaryDark"
        android:startColor="@color/colorPrimaryDark"
        android:endCollor="@color/colorPrimaryDark"
        android:type="linear" />
    <corners
        android:radius="10dp"/>
</shape>

注意“Android:endcollor”属性。

 类似资料:
  • 资源链接失败,我突然得到这个错误,当我使用我的android studio sdk版本28时,我在我的构建中得到下面的错误,该做什么可以帮助我解决我的问题 命令:c:\users\vijay.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\3630ad447130c7775c2d71e53cbfe7c2\aa

  • 我检查了XML文件的本地历史记录,并再次检查了清单文件,没有发现任何错误。 命令:c:\users\lucif.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\c9d8fd27aeabc6968bb2cb43f288855c\aapt2-3.2.1-4818971-windows\AAPT2.exe链接

  • 这是更新IDE后出现的错误 Android资源链接失败i:\Android\AndriodStudioProjects\MedicalApp\App\Build\Intermediates\Incremental\MergedebugResources\Merged.dir\values-v28\values-v28.xml:7:错误:找不到资源Android:attr/DialogCornerR

  • 所以一切都很顺利,当我去编辑一些.xml文件并构建项目时,现在我得到了一个gradle错误,上面写着: Android资源链接失败输出:H:\ Android projects \ codicy \ app \ src \ main \ RES \ layout \ activity _ app _ setup . XML:19:错误:找不到资源drawable/toolbarbackground

  • 我在使用Admob(适用于unity的谷歌移动广告SDK)和适用于unity的Facebook Audience Network SDK进行构建时遇到了这个错误。若我在项目中单独使用其中一个,那个么就不会出现错误,但若我同时使用这两个,那个么我在构建时就会出现这个错误。然而,我已经测试并可以确认,这个错误没有出现在Unity 2020版本中,但它出现在所有Unity 2018以及2019版本中。请

  • 再见,当我决定在android Studio上构建我的android应用程序时,我得到了这个错误。请问我怎么修复 C:\users\hp-pc.gradle\caches\transforms-2\files-2.1\dc1436142102318e0c7f87330e8cc57a\jetified-pinpad-1.0.1\res\values\values.xml:7:5-161:aapt:错