So in my project, we are overriding a preferences layout file - preference_category_material.xml from androidx.preference:preference library.
Our new code of preference_category_material.xml looks something like this
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="UnusedResources"
android:id="#android:id/textView"
...
/>
The TextView is the root and the only element in the file.
While running ./gradlew lintRelease I am getting this error:
Error: Overriding #layout/preference_category_material which is marked as private in androidx.preference:preference:1.2.0. If deliberate, use tools:override="true", otherwise pick a different name. [PrivateResource]
I have seen a similar question, but that deals with color tags: Override resources in library android
Adding tools:override="true" to the TextView in our file does nothing.
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="UnusedResources"
tools:override="true"
android:id="#android:id/textView"
...
/>
This does not solve the problem.
Any help is appreciated. Thanks.
This question already has answers here:
Android Studio shows wrong file contents
(10 answers)
Closed 3 years ago.
Once I create a new project I get an error
C:\Users\User\Desktop\4Find\app\src\main\res\values\colors.xml:9:18: Error: XML document structures must start and end within the same entity.
My colours.xml file at default looks as below;
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AndroidLayouts">
<shared>
<config />
</shared>
</component>
<component name="AndroidLogFilters">
<option n
I faced this problem before. Instead of reinstall it, what i did was delete AndroidStudio file which located at C:\Users\YourUserName\.AndroidStudio3.2 (.AndroidStudio file name should depends on your android studio version). This will reset android studio to default setting.
Hope this could help you.
colors.xml should be look like this:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#17AC82</color>
<color name="colorPrimaryDark">#17AC82</color>
<color name="colorAccent">#17AC82</color>
...........
</resources>
Something went wrong. It's not how colors.xml should look like, it's even not valid XML.
You can edit colors.xml but in my experience project will have other issues in its resources.
Try to create new project one more time.
Delete Android Studio file which located at
C:\Users\YourUserName\.AndroidStudio(version)
So I updated my Android Studio to v3.2. When I tried compiling the project, build fails.
Below is the error:
Android resource compilation failed
Output: C:\Users\Ashish\AndroidStudioProjects\StartUp\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:900: error: <item> inner element must either be a resource reference or empty.
Command: C:\Users\Ashish\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\7f1fbe9171e916e5044000cd76b749c8\aapt2-3.2.0-4818971-windows\aapt2.exe compile --legacy \
-o \
C:\Users\Ashish\AndroidStudioProjects\StartUp\app\build\intermediates\res\merged\debug \
C:\Users\Ashish\AndroidStudioProjects\StartUp\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml
Daemon: AAPT2 aapt2-3.2.0-4818971-windows Daemon #0
Please do tell if there is any more information required. Any help will be appreciated.
I was facing this issue today after updating gradle from 3.1.4 to 3.2.0. I don't know why, but the build started to throw that exception. i deleted the build folder, and deleted the gradle caches folder but nothing worked, so i looked at the merged values.xml and turns out that my ids.xml was defining a wrong id that was being merged to the values.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="downloading_package" type="id">Baixando pacote de sincronizaĆ§Ć£o</item>
</resources>
And apparently this was working before the update... for my case i deleted the ids.xml file (it was useless in the project)
I wish i could know why before the update everything was working
the <item> in values.xml at line 900 ...might be of resource-type id.
the correct syntax would be (just as the error message tells):
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item type="id" name="id_name" />
</resources>
see the documentation.
For me I had the layout width and layout height in the layout view and the LinearLayout view for databinding. This threw a duplicate error.
I fixed this by removing the layout_width and layout_height attributes in <layout>.
I'm just finishing this issue a few minutes ago, try to modify or delete id.xml, if you think you don't have it, try to find in another module in your app. I change my value resource from <item name="header_view" type="id">header_view</item> to <item name="header_view" type="id"/> and it worked for me.
just change your attr name which is present in resource -> values -> attr
<attr name="fontFamilys">
<enum name="roboto" value="0" />
<enum name="roboto_condensed" value="1" />
<enum name="roboto_slab" value="2" />
</attr>
for example if you are getting error related to fontFamily just change the the name build the application error will not come
i also meet the problem,you just need to find where the values in,and update it from <item type="id" name="id_name" >id_name</item> to <item type="id" name="id_name" />,now it's ok.
I got that problem when I'd quotation within <string> tag
<string name="vj_dialogue">I'm waiting</string>
when I escaped it with backslash '' . The problem was gone
<string name="vj_dialogue">I\'m waiting</string>
This could also happen if you mistakenly happened to not escape some value (apostrophe with backslash or ampersand with & or something else I am not aware of) under res/values/strings.xml file
to bring it in context here is an example ->
incorrect :
<string name="update_now">Let's Update now</string>
correct :
<string name="update_now">Let\'s Update now</string>
in your build gradle(Project:name) do it like that
classpath 'com.android.tools.build:gradle:3.+'
then rebuild your project .. after that it will show message to update your gradle from 4.6 to 4.10
In my case
<?xml version="1.0" encoding="utf-8"?>
is repeated twice in the XML. Make sure it should be one per a file at the top of the XML.
This is what worked for me:
In my build.gradle file > dependencies, I was implementing a newer version of appcompat library
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:support-v4:21.0.3'
implementation 'com.android.support:appcompat-v7:21.0.3'
implementation 'androidx.appcompat:appcompat:1.0.2'}
After commenting //implementation 'androidx.appcompat:appcompat:1.0.2' It worked fine. I would suggest, even if it's a different library, Please check the version you are using.
In your xml file, you may forget to add /> to brace your attribute.
I'm a bit new to programming so bear with me. I'm trying to create a FAB menu by following ResoCoder's tutorial on youtube, but there's an issue with the CoordinatorLayout element being declared.
It throws this warning:
The 'android.support.design.widget.CoordinatorLayout' is not declared.
Here's the AXML file.
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Hello FAB menu!"
android:textSize="24sp"/>
<View
android:id="#+id/bg_fab_menu"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#48000000"
android:alpha="0"
android:visibility="gone"/>
<android.support.design.widget.FloatingActionButton
android:id="#+id/fab_airballoon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="#dimen/standard_23"
android:visibility="gone"
android:rotation="90"
app:fabSize="mini"
app:srcCompat="#drawable/ic_airballoon"/>
</android.support.design.widget.CoordinatorLayout>
And here is an image of the warning.
Warning
edit:
This is now showing on the 'Designer' tab
Error on designer tab
Short Answer :
It's just a warning and not an error, you could compile your project without any problem.
Long Answer :
The problem is that the Intellisense could not pick the attributes you type although those attributes did exists in android SDK. So the Visual Studio shows that :
The 'android.support.design.widget.CoordinatorLayout' is not declared.
To solve this problem, you should enable Intellisense in Android .axml files. But a little difference with the document, you could download android-layout-xml.xsd and schemas.android.com.apk.res.android.xsd file from the following link :
https://github.com/atsushieno/monodroid-schema-gen/blob/master/android-layout-xml.xsd
https://github.com/atsushieno/monodroid-schema-gen/blob/master/schemas.android.com.apk.res.android.xsd
Download the file and edit the android-layout-xml.xsd and add the ConstraintLayout element. Then move these file manually to :
C:\Program Files (x86)\Microsoft Visual Studio 14.0\XML\Schemas\1033
Or simply just add these schemas within Visual Studio. Restart your VS, this warning will be gone
Suggestion :
It is recommend that ignoring the warning, you could compile your project without any problem.
Update :
Otherwise, after compiling I get errors like: 'Error: No resource found that matches the given name (at 'layout_margin' with value '#dimen/standard_23').' Which I assume are because of the CoordinatorLayout not being declared.
The dimen attribute need you create on yourself, make sure you copied the dimens.xml file too. You need create the dimens.xml in Resource\values\dimens.xml, define the standard_23 size in this file. Then the compile could find the standard_23 size.
dimen.xml :
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<dimen name="action_button_min_width">56dp</dimen>
<dimen name="indeterminate_progress_size">32dp</dimen>
<dimen name="standard_23">23dp</dimen>
</resources>
I am trying to use PixlUI to implement custom fonts into my Android app using Xamarin. I've followed these steps:
Added a new Android Java Bindings Library to my main solution
Added pixlui-1-0-5.jar to the jars folder
Under properties for pixlui-1-0-5.jar i've set the "include in deploy" to true
Tested my new Android Java Bindings Library and it builds fine without errors
Under the main project i've added my font to the assets/fonts folder
Under references i've added the pixlUI binding library
In my main.axml i've placed this code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:pixlui="http://schemas.android.com/apk/com.neopixl.pixlui"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:screenOrientation="portrait">
<com.neopixl.pixlui.components.textview.TextView
android:id="#+id/textViewpixl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/hello_world"
pixlui:copyandpaste="false"
pixlui:clearclipboardcontent="true"
pixlui:typeface="Lato-Light.ttf"
android:layout_below="#id/btnRebate"
/>
</RelativeLayout>
When I build my project it fails with 10 errors all referencing "already contains a definition for..." with error cs0102 inside the pixlUI files.
Ex: .../pixlUI/obj/Debug/generated/src/Com.Neopixl.Pixlui.Components.Edittext.IEditTextBatchListener.cs(59,59): Error CS0102: The type Com.Neopixl.Pixlui.Components.Edittext.AddNewCharEventArgs' already contains a definition forp0' (CS0102) (pixlUI)
I've tried troubleshooting this but it appears to be either an issue with pixlUI or conflict with something already in my solution. Does anyone have an idea on how to solve this?
First of all, you should change the Build Action for the pixelui.jar to EmbeddedJar.
Then you need to add the following to your binding's Metadata.xml file:
<!-- Bindings added to rename event parameters -->
<attr path="/api/package[#name='com.neopixl.pixlui.components.edittext']/interface[#name='EditTextBatchListener']/method[#name='addNewChar']/parameter[#name='p0']" name="name">editText</attr>
<attr path="/api/package[#name='com.neopixl.pixlui.components.edittext']/interface[#name='EditTextBatchListener']/method[#name='deleteKeyboardButton']/parameter[#name='p0']" name="name">editText</attr>
<attr path="/api/package[#name='com.neopixl.pixlui.components.edittext']/interface[#name='EditTextBatchListener']/method[#name='deleteKeyboardButton']/parameter[#name='p1']" name="name">emptyText</attr>
<attr path="/api/package[#name='com.neopixl.pixlui.components.edittext']/interface[#name='EditTextFocusListener']/method[#name='loseFocus']/parameter[#name='p0']" name="name">editText</attr>
<attr path="/api/package[#name='com.neopixl.pixlui.components.edittext']/interface[#name='EditTextFocusListener']/method[#name='requestFocus']/parameter[#name='p0']" name="name">editText</attr>
Rebuild your bindings then you should be able to use it in your Android app.
Here's a screenshot from the sample project: