37

I got this error after update my Gradle (I have also added maven{jitpack.io} and geofirestore dependencies at the same of updating Gradle) :

Android resource linking failed
Output:  C:\Users\Paul\AndroidStudioProjects\How2Ride2\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
C:\Users\Paul\AndroidStudioProjects\How2Ride2\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.
C:\Users\Paul\AndroidStudioProjects\How2Ride2\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1169: error: resource android:attr/fontVariationSettings not found.
C:\Users\Paul\AndroidStudioProjects\How2Ride2\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1170: error: resource android:attr/ttcIndex not found.
error: failed linking references.

Command: C:\Users\Paul\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\74062dcec80f00402d5904d26f22db6e\aapt2-3.2.0-4818971-windows\aapt2.exe link -I\
        C:\Users\Paul\AppData\Local\Android\Sdk\platforms\android-27\android.jar\
        --manifest\
        C:\Users\Paul\AndroidStudioProjects\How2Ride2\app\build\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
        -o\
        C:\Users\Paul\AndroidStudioProjects\How2Ride2\app\build\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
        -R\
        @C:\Users\Paul\AndroidStudioProjects\How2Ride2\app\build\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
        --auto-add-overlay\
        --java\
        C:\Users\Paul\AndroidStudioProjects\How2Ride2\app\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
        --custom-package\
        com.how2ride.how2ride\
        -0\
        apk\
        -c\
        en,fr\
        --output-text-symbols\
        C:\Users\Paul\AndroidStudioProjects\How2Ride2\app\build\intermediates\symbols\debug\R.txt\
        --no-version-vectors
Daemon:  AAPT2 aapt2-3.2.0-4818971-windows Daemon #0

How can I solve this?

Here my Project build gradle:

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:4.0.2'
    }
}

allprojects {
    repositories {
        google()
        jcenter()

        maven { url 'https://jitpack.io' }
    }
}

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

and my Module build gradle:

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.how2ride.how2ride"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        resConfigs "en", "fr"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.google.android.gms:play-services-maps:15.0.1'
    implementation "com.google.android.gms:play-services-location:15.0.1"
    implementation 'com.google.firebase:firebase-ads:15.0.1'
    implementation 'com.google.firebase:firebase-core:16.0.3'
    implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
    implementation 'com.google.firebase:firebase-auth:16.0.3'
    implementation 'com.google.firebase:firebase-firestore:17.1.0'
    implementation 'com.github.imperiumlabs:GeoFirestore-Android:v1.1.1'
    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'
}

apply plugin: 'com.google.gms.google-services'

I have the last version of android studio and my project worked perfectly before upgrading my gradle...

Milvintsiss
  • 1,420
  • 1
  • 18
  • 34

7 Answers7

57

Change the compileSdkVersion to:

compileSdkVersion 28

These attributes were added in this version. Check here, here and here

kike
  • 4,255
  • 5
  • 23
  • 41
9

Downgrade your gradle version to 3.1.4 i.e classpath 'com.android.tools.build:gradle:3.1.4'

  • This worked for me: R.java was not found anymore after updating to Gradle version 3.3.0. Downgrading to 3.2.1 solved the issue. Thanks a lot! – Richard R Feb 05 '19 at 13:36
7

Downgrade gradle on 3.1.4 . Check for your build.gradle(Modele:App) file:

    classpath 'com.android.tools.build:gradle:3.1.4'

The project was built :)

5

check for your graddle-wrapper.properties file

Sun Jul 08 23:40:54 KST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

check the last line the gradle version file url

Kiwan Park
  • 81
  • 4
3

try this code in this build.gradle

 classpath 'com.android.tools.build:gradle:3.1.4'
Najib.Nj
  • 3,706
  • 1
  • 25
  • 39
2

Set your classpath to the current build gradle and sync your project.There seems to be an issue with Android studio version 3.2. When prompted to update gradle also update the classpath values.

Icemark Muturi
  • 801
  • 7
  • 11
2

was facing this issue today after updating to the new gradle 3.0.1 to 3.2.0 for my case i deleted the ids.xml file in values folder (it was useless in the project) work for me