Anandha Murthy B
Anandha Murthy B

Reputation: 27

Getting Android resource linking failed

we are building an android project and when we are trying to build the project, we are getting Android resource building failed

For the odd reason, it is pointing to a file which is not a part of our project located at

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_left_corner_radius (aka com.package.android:attr/top_left_corner_radius) not found

We tried the following solutions, but it did not work

We don't know why this error is coming and what is the reason behind that! Pasting gradle file for more details

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

Upvotes: 2

Views: 3387

Answers (1)

LGTech
LGTech

Reputation: 11

This error is absolutely nothing serious.The error shows up when Gradle encounters an error (Usually a syntax or typo error) in one or more of your XML files.

Most of the XML files are located in the res folder, however, you might still find some outside the res folder. For example, the AndroidManifest.xml located in “/src/main/AndroidManifest.xml”. Here is an example of a layout file that would give the “Error: failed linking file resources” error.

<?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>

Note the “android:endCollor” attribute.

Solution

All you have to do is go through each of your XML files to figure out where the error might be. This could sometimes be time-consuming but be rest assured that the error will disappear as soon as you find and fix the problem child (problem XML).

You might be lucky and Android Studio will point you in the exact direction Other times like when you are using an older version of Android Studio, the error would not be this specific. And that’s it. I hope you will be able to figure it out.

Upvotes: 1

Related Questions