0
votes

I just updated my android studio to version 3.2.1 and also updated my gradle via android studio to latest version, but building project faces this error:

Android resource compilation failed Output: D:\projects\myProject\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2577: error: inner element must either be a resource reference or empty. D:\projects\myProject\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2585: error: inner element must either be a resource reference or empty.

Command: C:\Users\Hamed.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\ea639d8248f3ebb66b449dfd3b6a9a07\aapt2-3.2.1-4818971-windows\aapt2.exe compile --legacy \ -o \ D:\projects\myProject\app\build\intermediates\res\merged\debug \ D:\projects\myProject\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #0

and In the line it says there is an error, this code exists:

<item name="googledefaultpass" type="id">123456789</item>

What is wrong? As I searched the solution is this, but the structure is the same.

I have updated all my libraries.

app level gradle:

apply plugin: 'com.android.application'
android {
    compileSdkVersion 27
    buildToolsVersion '28.0.3'
    defaultConfig {
        applicationId "com.my.project"
        minSdkVersion 15
        targetSdkVersion 27
        versionCode 1
        versionName "0.7"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        manifestPlaceholders = [onesignal_app_id               : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                                // Project number pulled from dashboard, local value is ignored.
                                onesignal_google_project_number: "REMOTE"]
    }
    applicationVariants.all { variant ->
        variant.resValue "string", "versionName", variant.versionName
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
repositories {
    jcenter()
}
dependencies {
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    //    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    //    compile 'im.crisp:crisp-sdk:0.1.10'
    implementation 'com.getkeepsafe.taptargetview:taptargetview:1.11.0'
    implementation 'com.stephentuso:welcome:1.4.1'
    implementation 'co.ronash.android:pushe-base:1.4.0'
    implementation 'com.google.android.gms:play-services-gcm:16.0.0'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.android.support:customtabs:27.1.1'
    //    compile 'com.google.firebase:firebase-auth:16.0.2'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation('io.socket:socket.io-client:1.0.0') {
        // excluding org.json which is provided by Android
        exclude group: 'org.json', module: 'json'
    }
    implementation 'com.android.volley:volley:1.1.0'
    testImplementation 'junit:junit:4.12'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
}


configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '28.+'
            }
        }
    }
}

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

project level gradle:

repositories {
        google()
        maven { url 'https://maven.google.com' }
        jcenter()
        mavenCentral()
        buildscript {
            repositories {
                google()
                jcenter()
            }
            dependencies {
                classpath 'com.android.tools.build:gradle:3.2.1'
                classpath 'com.google.gms:google-services:4.0.1'
            }
        }

        allprojects {
    }
}

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

update:

I invalidated cache and restarted Android studio, the problem solved, but I faced the following error:

> Could not find org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.2.71.
> Searched in the following locations:
>     https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.2.71/kotlin-stdlib-jdk8-1.2.71.pom
>     https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.2.71/kotlin-stdlib-jdk8-1.2.71.jar
>     https://maven.google.com/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.2.71/kotlin-stdlib-jdk8-1.2.71.pom
>     https://maven.google.com/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.2.71/kotlin-stdlib-jdk8-1.2.71.jar
> Required by:
>     project : > com.android.tools.build:gradle:3.2.1
>     project : > com.android.tools.build:gradle:3.2.1 > com.android.tools.build:builder:3.2.1
>     project : > com.android.tools.build:gradle:3.2.1 > com.android.tools.lint:lint-gradle-api:26.2.1
>     project : > com.android.tools.build:gradle:3.2.1 > com.android.tools.build:gradle-api:3.2.1
>     project : > com.android.tools.build:gradle:3.2.1 > androidx.databinding:databinding-compiler-common:3.2.1
>     project : > com.android.tools.build:gradle:3.2.1 > com.android.tools.build:builder:3.2.1 >
> com.android.tools:sdk-common:26.2.1
>     project : > com.android.tools.build:gradle:3.2.1 > com.android.tools.build:builder:3.2.1 >
> com.android.tools:common:26.2.1
>     project : > com.android.tools.build:gradle:3.2.1 > com.android.tools.build:builder:3.2.1 >
> com.android.tools.build:manifest-merger:26.2.1
>     project : > com.android.tools.build:gradle:3.2.1 > com.android.tools.build:builder:3.2.1 >
> com.android.tools:sdklib:26.2.1 > com.android.tools:repository:26.2.1

The point is that I am not using Kotlin at all. I added classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71" to gradle dependencies but the same error raises. I searched Kotlin in whole project, but there was nothing but some replay_pid1632.log files.

tnx

3
Did you tried to Invalidate Caches and Restart?Alex
Delete Project->app ->build folder. If you are not able to delete it directly, then you can delete all inner folders like generated, intermediates, outputs, etc... and then do invalid caches / Restart.Rumit Patel
@Alex would you check my post update please? tnxhsbr13
@RumitPatel would you check my post update please? tnxhsbr13
I can't figured it out why you are getting kotlin error. you can do again according my first comment. or you can try with updating all gradle dependencies to latest.Rumit Patel

3 Answers

2
votes

resource-type id must not have a value.

therefore, change:

<item name="googledefaultpass" type="id">123456789</item>

to either:

<item name="googledefaultpass" type="integer">123456789</item>
<item name="googledefaultpass" type="string">123456789</item>

or remove the entry and obtain the account with the AccountManager, instead.

concerning the kotlin-stdlib-jdk8 dependency; it's available in repository mavenCentral():

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.10"

and maybe also remove this duplicate dependency entry:

implementation fileTree(include: ['*.jar'], dir: 'libs')
1
votes

I don't think you should be giving a value to id type resource. Change

<item name="googledefaultpass" type="id">123456789</item>

to 

<item name="googledefaultpass" type="id"/>
0
votes

Try to add

classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71'

inside project level gradle dependencies, and then add

implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.71'

inside your app level gradle. Maybe one of your libraries require kotlin plugin.