获取Android资源链接失败

获取Android资源链接失败,android,android-studio,build.gradle,Android,Android Studio,Build.gradle,我们正在构建一个android项目,当我们试图构建该项目时,我们发现android资源构建失败了 出于奇怪的原因,它指向的文件不是位于 C:\location.gradle\caches\transforms-2\files-2.1\87cdecd973dcf2cf22fdc9f513d1a506\RoundKornerLayouts-0.4.0\res\values\values.xml:4:5-258:AAPT:error:resource attr/top\u left\u corner\

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

出于奇怪的原因,它指向的文件不是位于

C:\location.gradle\caches\transforms-2\files-2.1\87cdecd973dcf2cf22fdc9f513d1a506\RoundKornerLayouts-0.4.0\res\values\values.xml:4:5-258:AAPT:error:resource attr/top\u left\u corner\u radius(又名com.package.android:attr/top\u left\u corner\u 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'
    }}


此错误绝对不严重。当Gradle在一个或多个XML文件中遇到错误(通常是语法或打字错误)时,就会出现此错误

大多数XML文件都位于res文件夹中,但是,您可能仍然可以找到一些 在res文件夹之外。例如,AndroidManifest.xml位于“/src/main/AndroidManifest.xml”中。下面是一个布局文件的示例,该文件将出现“错误:链接文件资源失败”错误

<?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”属性

解决方案

您所要做的就是浏览每个XML文件,找出错误可能在哪里。这有时可能很耗时,但请放心,一旦找到并修复问题子项(问题XML),错误就会消失

你可能很幸运,Android Studio会为你指明正确的方向 其他情况下,比如当您使用旧版本的Android Studio时,错误不会如此具体。就这样。我希望你能弄明白