I have a xml file. dimens.xml. There I have an entry like
<item name="attr_name" format="float" type="vals">1.0</item>
However when I try to run gradle build, gradle gives an error 'Execution failed for task ':mergeDebugResources'. Unsupported type 'vals'
I am fetching the value as context.getResources().getValue(R.vals.store_list_view_width_ratio...
How do I tackle this so that gradle does not give any error. Also I removed the type attribute, then gradle started saying unknown type 'item'
What should be done?
vals is not valid. Use type="dimen" and R.dimen...
Reference: https://stackoverflow.com/a/20120240/2649012
Related
I'm getting this error with Gradle 7.0 while it was working fine for 6.8.3
agcp-gradle-7-error
AGCPlugin
FAILURE: Build failed with an exception.
What went wrong:
A problem was found with the configuration of task ':app:processDebugAGCPlugin' (type 'AGCPluginTask').
Type 'AGCPluginTask' property 'randomEncryptComponent' of type boolean shouldn't be annotated with #Optional.
Reason: Properties of primitive type cannot be optional.
Possible solutions:
Remove the #Optional annotation.
Use the java.lang.Boolean type instead.
Please refer to https://docs.gradle.org/7.0/userguide/validation_problems.html#cannot_use_optional_on_primitive_types for more details about this problem.
I no longer get any errors with:
classpath 'com.huawei.agconnect:agcp:1.5.2.300'
and
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
Currently Gradle 7.0 is not supported. As I hear, it will be supported at the end of June.
Android resource compilation failed
E:\VectorAssetDemo\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:157:
error: invalid color.
E:\VectorAssetDemo\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:
error: file failed to compile.
I have tried nothing.
no debuggable process
I was trying to use vector asset in an ImageView and I was also trying to implement colors on them.
A color in values.xml needs to follow this format.
<color name="theColorName">#000000</color>
A few days ago I created a string (value) call prompt_name but somehow its ended up ad a dimen in the values.xml. I keep trying to removing it but the file is rebuilt each time. How can I delete prompt_name so it doesnt occur any more.
Here is the error from the starting the cradle project sync:
Gradle tasks :app:generateDebugAndroidTestSources,
string 'prompt_name' has no default translation.
String types not allowed (at 'prompt name' with value 'Name').
String types not allowed (at 'prompt name' with value 'Name').
Execution failed for task
com.android.ide.common.process.ProcessException: Failed to execute aapt
BUILD FAILED
Here is the line in values.xml:
<dimen name="prompt_name">Name</dimen>
You are editing generated values.xml file, this is useless because it is regenerated with each build. Look at the path of this file it looks something like "build\intermediates\res\mreged\debug\values\values.xml".
Instead you have to find real source file where incorrect line comes from, in your case this is probably dimens.xml and fix the line there.
My project does not gradle it shows:
Error:Execution failed for
task ':app:mergeDebugResources'.
D:\Android\MatarealDesigen\app\src\main\res\values\styles.xml: Error: Unsupported node 'item'
Please go to res/values/styles.xml and find the error there. One of the tags called "item" is probably in the wrong place (it should be highlighted in red) :-)
In my case the name of one of the attributes was misspelled:
tye="layout"
instead of
type="layout"
I decompiled an app using an online tool (www.decompileandroid.com) then, after I downloaded the zipped source code (assets + java code), I extracted it in a folder and finally I imported the folder in android studio (File>New>Import Project).
Then, without editing any file, I tried to run the project but I got this error:
Error: Found item ###/ITEM-NAME more than one time
Error:Execution failed for task ':app:mergeDebugResources'. > C:\Users\Fabrizio\AndroidStudioProjects\com.hwlogos.ytstars\app\src\main\res\values\public.xml: Error: Found item ###/ITEM.NAME more than one time
I searched the web for hours but I can't find any useful answer...
Please help!
PS: I tried also with other applications but I always get the same error...
UPDATE:
Now I tried to decompile a simple app i created with android studio and when I reimported it in android studio I got the same error.
it seems there are two resources with the same name, one declared as string and the other as id.
Here's a part of my public.xml, which i never wrote when I made my application!!!
<public type="string" name="action_settings" id="0x7f070006" />
<public type="id" name="action_settings" id="0x7f09000a" />
Create a new xml ids.xml in values with all the id values which are to be constant.
<resources>
<item type="id" name="index_row_search" />
</resources>
I think its better if you copy the resource ids to public.xml from the R.java, the first time to avoid errors like entry index is larger than available symbols and also to keep the type of resource to be consistent.
visit here for more help How to add id to public.xml?