I had faced following error when I update versions in Gradle:
C:\Users\03142\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\7e646e2ca904450b985ca981ac3ba677\res\values\values.xml
Error:(251, 5) error: duplicate value for resource 'attr/mode' with config ''.
Error:(251, 5) error: resource previously defined here.
How to Resolved it?
You have defined same resources for multiple times. Like you are using any module for your app but you initialled them multiple times in gradle file.
Related
I am using android studio version 4.1.3 and gradle version 6.8.3 . My target sdk version for the project is API 26.
After clicking on sync the project, the result seems have no problem but after clicking on run app, I have some errors. One of them says,
gradle-6.8.3\caches\transforms-3\71de35e86c45a332199eb23f9129d32f\transformed\material-1.4.0\res\values\values.xml:1316:-1327:11: AAPT: error: style attribute 'android:attr/dialogCornerRadius' not found
I have seen the Error:(9, 5) error: resource android:attr/dialogCornerRadius not found
But again the problem is not solved
I don't know what should I do?
Please Help
When I connect my project file with fireBase the following error comes up.
null
resource style/TextAppearance.Compat.Notification.Info (aka com.kangkan.developer.f_c_m:style/TextAppearance.Compat.Notification.Info) not found.
resource style/TextAppearance.Compat.Notification (aka com.kangkan.developer.f_c_m:style/TextAppearance.Compat.Notification) not found.
resource style/TextAppearance.Compat.Notification.Time (aka com.kangkan.developer.f_c_m:style/TextAppearance.Compat.Notification.Time) not found.
resource style/TextAppearance.Compat.Notification.Title (aka com.kangkan.developer.f_c_m:style/TextAppearance.Compat.Notification.Title) not found.
failed linking references.
The Screen Shot
R class also showed error
I've cleaned the project, invalidate caches/restart,
It's not gone, I am using the firebase core implementation 'com.google.firebase:firebase-core:16.0.1'
This can result in several reasons.
Make sure you are using an updated version of android-gradle-plugin
Make sure there are no dependency version clashed in build.gradle file.
Check whether your XML resources don't have errors.
Hope this helps!
I use Android Studio 3.1.4 and android gradle plugin version 3.1.4.
Previously I set buildToolsVersion "27.0.3" in build.gradle of module and there was no problem in building/running. Today I installed newer version of build tools and change build.gradle to use that: buildToolsVersion "28.0.2"
But when I try to sync project with gradle files or rebuild project it ends with AAPT2 error:
AGPBI: {"kind":"error","text":"error: \u003citem\u003e inner element must either be a resource reference or empty.","sources":[{"file":"<path to module>/src/main/res/values/ids.xml","position":{"startLine":16,"startColumn":4,"startOffset":752,"endColumn":55,"endOffset":803}}],"original":"","tool":"AAPT"}
....
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':<modulee-name>:mergeDebugResources'.
> Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
But I do not understand what causes the error. For example addressed line in error is:
<item type="id" name="bookmark">false</item>
What causes this error and how I can solve this problem?
Edit
I added android.enableAapt2=false to the gradle.properties and it seems ignores error, but causes this warning:
The option 'android.enableAapt2' is deprecated and should not be used
anymore. Use 'android.enableAapt2=true' to remove this warning. It
will be removed at the end of 2018..
you cannot assign false (nor any other value but it's name) to an ID resource.
An ID is a simple resource that is referenced using the value provided in the name attribute (not the name of the XML file). As such, you can combine ID resources with other simple resources in the one XML file, under one element. Also, remember that an ID resources does not reference an actual resource item; it is simply a unique ID that you can attach to other resources or use as a unique integer in your application.
with android.enableAapt2=false it might ignore the logical error, but not "fix it".
When I add the core-ktx dependency to my app's build.gradle file, my gradle builds fail with the error message AAPT2 error: check logs for details
It furthermore tells that there are two attributes missing in values.xml. This file is located under the .gradle folder inside my user directory.
when I add android.enableAAPT2=false to my project properties, the build fails due to that option being deprecated so I want to avoid that.
The error descriptions of the two resource not found errors are the following:
error: resource android:attr/fontVariationSettings not found.
Message{kind=ERROR, text=error: resource android:attr/fontVariationSettings not found., sources=[C:\Users\Marc.gradle\caches\transforms-1\files-1.1\appcompat-v7-26.1.0.aar\b6d4f8d4d33639ae469eaec181e24176\res\values\values.xml], original message=, tool name=Optional.of(AAPT)}
When I add different ktx libraries everything is just fine. It builds properly and I can even import androidx.collections! How can I add the core-ktx library without any errors?
You are using 'AndroidX' which is only available if you set your compileSdkVersion 'android-P' and targetSdkVersion 28. Then in AndroidStudio go to Refactor -> Refactor to AndroidX and everything should work fine now :).
I am working on an android project that used Gradle 2.3.3 (at this point, there was no compiling issues). I upgraded Gradle to version 3.0.1, and made the required adjustments.
I removed retrolambda. I changed the keywords to use the new dependency configurations.
But my project doesn't compile, because it seems that android.R.* elements are not found anymore. The errors I have are :
Error:(524, 27) error: cannot find symbol variable id
Error:(625, 122) error: cannot find symbol variable id
Error:(74, 63) error: cannot find symbol variable color
on the following ids : android.R.id.home, and android.R.color.white.
What changed on Gradle 3.0.1 that could have triggered these errors ?
EDIT : I already tried to clear/invalidate caches, restart, sync Project with gradle files, clean, rebuild...
A coworker tried to compile the code on his computer : same error - it doesn't look like it is a cache issue.