0

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

6
  • Did you tried to Invalidate Caches and Restart? Commented Dec 4, 2018 at 8:46
  • 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. Commented Dec 4, 2018 at 9:09
  • @Alex would you check my post update please? tnx Commented Dec 4, 2018 at 10:44
  • @RumitPatel would you check my post update please? tnx Commented Dec 4, 2018 at 10:44
  • 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. Commented Dec 4, 2018 at 10:55

4 Answers 4

3

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')
Sign up to request clarification or add additional context in comments.

Comments

1

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"/>

1 Comment

Maybe any of your dependencies are using Kotlin, not sure. Please try this stackoverflow.com/questions/53448450/…
1

In my case the problem was that I forgot to escape an apostrophe sign within an item of a StringArray.

So in my strings.xml I changed

<string-array name="questions">
    <item>What's the weather today?</item>
</string-array>

to

<string-array name="questions">
    <item>What\'s the weather today?</item>
</string-array>

And now it builds perfectly fine.

1 Comment

This was my issue too saved me hours lol
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.