Whenever I try and build my project, I get this error:
Android resource compilation failed
Output:
C:\Users\smart\AndroidStudioProjects\ShoppingList\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:497: error: :listItem>.
C:\Users\smart\AndroidStudioProjects\ShoppingList\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:498: error: :listItem>.
C:\Users\smart\AndroidStudioProjects\ShoppingList\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:499: error: :listItem>.
C:\Users\smart\AndroidStudioProjects\ShoppingList\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:503: error: :listItem>.
C:\Users\smart\AndroidStudioProjects\ShoppingList\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:504: error: :listItem>.
Command: C:\Users\smart\.gradle\caches\transforms-1\files-1.1\aapt2-3.3.0-alpha02-4818971-windows.jar\a281fb5dd58b50951126c2252f73d452\aapt2-3.3.0-alpha02-4818971-windows\aapt2.exe compile --legacy \
-o \
C:\Users\smart\AndroidStudioProjects\ShoppingList\app\build\intermediates\res\merged\debug \
C:\Users\smart\AndroidStudioProjects\ShoppingList\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml
Daemon: AAPT2 aapt2-3.3.0-alpha02-4818971-windows Daemon #2
The xml lines in question are:
<color name="colorPrimary">#d50000</color>
<color name="colorPrimaryDark">#b71c1c</color>
<color name="colorAccent">#757575</color>
<listItem name="windowActionBar">false</listItem>
<listItem name="windowNoTitle">true</listItem>
I am using
classpath 'com.android.tools.build:gradle:3.3.0-alpha02'
And my app gradle file is:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.my.kellen.shoppinglist"
minSdkVersion 14
targetSdkVersion 26
versionCode 2
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:design:26.1.0'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.2'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.bignerdranch.android:expandablerecyclerview:1.0.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'
// Room components
implementation "android.arch.persistence.room:runtime:1.1.1"
annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
androidTestImplementation "android.arch.persistence.room:testing:1.1.1"
// Lifecycle components
implementation "android.arch.lifecycle:extensions:1.1.1"
annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
}
apply plugin: 'com.google.gms.google-services'
Can anyone help me out? I've tried cleaning and rebuilding the project, and checked over all of the lines in question. I didn't even modify them recently, so I'm not sure whats going on.
EDIT - I've reverted my classpath
to 3.1.3 and the distributionUrl
to 4.5, and now I get a different error message:
Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details.
The log says:
error: :listItem>.
Message{kind=ERROR, text=error: :listItem>., sources=`[C:\Users\smart\AndroidStudioProjects\ShoppingList\app\src\main\res\values\styles.xml:17:5-90], original message=, tool name=Optional.of(AAPT)}`
And points towards two different xml lines that should be valid:
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light"/>
why not to change your gradle plugin version?
First: finding how many local gradle available by looking your gradle file, 'file'->'setting'->'Build, Execuion, Deployment'->'Gradle',then you will find this file which contain a file named 'wrapper\dists', open it and you will see them.
Second: Edit file named 'gradle-wrapper.properties', and change distributionUrl
's value to a version which is included in your local gradle group.
Last: change the classpath
in your build.gradle
,there is a link your can get help from it.
help you'll understand my poor English, so that i can help you:)
I don't konw why but this work for my project. such as the problem,i get seam error just like your. i fix them like this:i search error location
Android resource compilation failed
Output: F:\Works\AndroidProject\lbw\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1703: error: duplicate value for resource 'attr/progress' with config ''.
F:\Works\AndroidProject\lbw\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1703: error: resource previously defined here.
Command: C:\Users\Administrator\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\802c7c840816e44cd175d342954a2954\aapt2-3.2.1-4818971-windows\aapt2.exe compile --legacy \
-o \
F:\Works\AndroidProject\lbw\app\build\intermediates\res\merged\debug \
F:\Works\AndroidProject\lbw\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml
Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #0
then i search the file
F:\Works\AndroidProject\lbw\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml
and i find the location at lines 1703 enter image description here
and i find the error location in the file enter image description here
and i copy the name absProgressBar
search in attrs
then i get the error location
enter image description here
than i commenty <!-- <attr name="progress" format="integer" />-->
build argen the error will be gone.
I got something similar where the Android resource compilation failed.
error: <item> inner element must either be a resource reference or empty.
I'm seeing some posts that suggest deleting a "ids.xml" file and that fixes the issue. While that may fix it, you may be doing more harm since code may refer to that id tag.
I fixed my issue by updating the "ids.xml" file from:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="item_click_support" type="id">id</item>
</resources>
To:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="item_click_support" type="id"/>
</resources>
Notice how the Item tag is a self closing xml element now. This is the correct way to list id's within the "ids.xml" file now. You can refer to the official Android documentation for this as well.
Cheers!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With