- Solve element selector must be declared Error in Android Studio
- How to Solve element selector must be declared Error in Android Studio.
- Menu Resource
- See also
- Solve element selector must be declared Error in Android Studio
- How to fix selector, shape, item and set XML file attributes error in Android Studio drawable resource file project error.
- How to Solve element selector must be declared Error in Android Studio.
- duplicated with element declared at AndroidManifest.xml #418
- Comments
- MohammedSaberMohammed commented Feb 25, 2017 •
- wildabeast commented Mar 16, 2017
- jbankester commented Apr 5, 2017
- jbankester commented Apr 6, 2017
- macdonst commented Apr 6, 2017
- jbankester commented Apr 6, 2017
- thomasblom commented Jun 26, 2017
- giscafer commented Jul 13, 2017
- teckyin commented Jul 31, 2017
- jaufgang commented Aug 18, 2017 •
Solve element selector must be declared Error in Android Studio
External resource XML file is one of the most important for android projects because whenever android developer need to implement any kind of layout related designing like setting up different types of shape at the background of widgets or adding animations or creating custom seekbar ETC. So in android studio the project structure became slightly different from Eclipse and all that type of XML files shows attributes error like ” Solve element selector must be declared Error “. So in this tutorial we are going to solve this problem from our android project so all the developers can easily use custom XML files.
Note : Solution for fixing this problem is very simple all we have to do is create XML resource file into only drawable folder. So in below tutorial we are only learning the way to create resource XML file into drawable folder.
How to Solve element selector must be declared Error in Android Studio.
1. Open your project in Android Studio.
2. Select drawable folder.
3. Now right click on drawable folder -> New -> Drawable Resource File.
4. Now enter file name and click on OK button to create drawable resource xml file.
Note: We have to create XML resource file inside drawable folder to work it correctly.
Источник
Menu Resource
See also
A menu resource defines an application menu (Options Menu, Context Menu, or submenu) that can be inflated with MenuInflater .
For a guide to using menus, see the Menus developer guide.
file location: res/menu/filename.xml
The filename will be used as the resource ID. compiled resource datatype: Resource pointer to a Menu (or subclass) resource. resource reference: In Java: R.menu.filename
In XML: @[package:]menu.filename syntax: elements: Required. This must be the root node. Contains and/or elements.
xmlns:android XML namespace. Required. Defines the XML namespace, which must be «http://schemas.android.com/apk/res/android» . A menu item. May contain a element (for a Sub Menu). Must be a child of a or element.
android:id Resource ID. A unique resource ID. To create a new resource ID for this item, use the form: «@+id/name» . The plus symbol indicates that this should be created as a new ID. android:title String resource. The menu title as a string resource or raw string. android:titleCondensed String resource. A condensed title as a string resource or a raw string. This title is used for situations in which the normal title is too long. android:icon Drawable resource. An image to be used as the menu item icon. android:onClick Method name. The method to call when this menu item is clicked. The method must be declared in the activity as public and accept a MenuItem as its only parameter, which indicates the item clicked. This method takes precedence over the standard callback to onOptionsItemSelected() . See the example at the bottom.
Warning: If you obfuscate your code using ProGuard (or a similar tool), be sure to exclude the method you specify in this attribute from renaming, because it can break the functionality.
Introduced in API Level 11.
android:showAsAction Keyword. When and how this item should appear as an action item in the Action Bar. A menu item can appear as an action item only when the activity includes an ActionBar (introduced in API Level 11). Valid values:
Value | Description |
---|---|
ifRoom | Only place this item in the Action Bar if there is room for it. |
withText | Also include the title text (defined by android:title ) with the action item. You can include this value along with one of the others as a flag set, by separating them with a pipe | . |
never | Never place this item in the Action Bar. |
always | Always place this item in the Action Bar. Avoid using this unless it’s critical that the item always appear in the action bar. Setting multiple items to always appear as action items can result in them overlapping with other UI in the action bar. |
collapseActionView | The action view associated with this action item (as declared by android:actionLayout or android:actionViewClass ) is collapsible. Introduced in API Level 14. |
See the Action Bar developer guide for more information.
Introduced in API Level 11.
android:actionLayout Layout resource. A layout to use as the action view.
See the Action Bar developer guide for more information.
Introduced in API Level 11.
android:actionViewClass Class name. A fully-qualified class name for the View to use as the action view. For example, «android.widget.SearchView» to use SearchView as an action view.
See the Action Bar developer guide for more information.
Warning: If you obfuscate your code using ProGuard (or a similar tool), be sure to exclude the class you specify in this attribute from renaming, because it can break the functionality.
Introduced in API Level 11.
android:actionProviderClass Class name. A fully-qualified class name for the ActionProvider to use in place of the action item. For example, «android.widget.ShareActionProvider» to use ShareActionProvider .
See the Action Bar developer guide for more information.
Warning: If you obfuscate your code using ProGuard (or a similar tool), be sure to exclude the class you specify in this attribute from renaming, because it can break the functionality.
Introduced in API Level 14.
android:alphabeticShortcut Char. A character for the alphabetic shortcut key. android:numericShortcut Integer. A number for the numeric shortcut key. android:checkable Boolean. «true» if the item is checkable. android:checked Boolean. «true» if the item is checked by default. android:visible Boolean. «true» if the item is visible by default. android:enabled Boolean. «true» if the item is enabled by default. android:menuCategory Keyword. Value corresponding to Menu CATEGORY_* constants, which define the item’s priority. Valid values:
Value | Description |
---|---|
container | For items that are part of a container. |
system | For items that are provided by the system. |
secondary | For items that are user-supplied secondary (infrequently used) options. |
alternative | For items that are alternative actions on the data that is currently displayed. |
android:orderInCategory Integer. The order of «importance» of the item, within a group. A menu group (to create a collection of items that share traits, such as whether they are visible, enabled, or checkable). Contains one or more elements. Must be a child of a element.
android:id Resource ID. A unique resource ID. To create a new resource ID for this item, use the form: «@+id/name» . The plus symbol indicates that this should be created as a new ID. android:checkableBehavior Keyword. The type of checkable behavior for the group. Valid values:
Value | Description |
---|---|
none | Not checkable |
all | All items can be checked (use checkboxes) |
single | Only one item can be checked (use radio buttons) |
android:visible Boolean. «true» if the group is visible. android:enabled Boolean. «true» if the group is enabled. android:menuCategory Keyword. Value corresponding to Menu CATEGORY_* constants, which define the group’s priority. Valid values:
Value | Description |
---|---|
container | For groups that are part of a container. |
system | For groups that are provided by the system. |
secondary | For groups that are user-supplied secondary (infrequently used) options. |
alternative | For groups that are alternative actions on the data that is currently displayed. |
android:orderInCategory Integer. The default order of the items within the category. example: XML file saved at res/menu/example_menu.xml :
The following application code inflates the menu from the onCreateOptionsMenu(Menu) callback and also declares the on-click callback for two of the items:
Note: The android:showAsAction attribute is available only on Android 3.0 (API Level 11) and greater.
Источник
Solve element selector must be declared Error in Android Studio
How to fix selector, shape, item and set XML file attributes error in Android Studio drawable resource file project error.
External resource XML file is one of the most important for android projects because whenever android developer need to implement any kind of layout related designing like setting up different types of shape at the background of widgets or adding animations or creating custom seekbar ETC. So in android studio the project structure became slightly different from Eclipse and all that type of XML files shows attributes error like ” Solve element selector must be declared Error “. So in this tutorial we are going to solve this problem from our android project so all the developers can easily use custom XML files.
Note : Solution for fixing this problem is very simple all we have to do is create XML resource file into only drawable folder. So in below tutorial we are only learning the way to create resource XML file into drawable folder.
How to Solve element selector must be declared Error in Android Studio.
1. Open your project in Android Studio.
2. Select drawable folder.
3. Now right click on drawable folder -> New -> Drawable Resource File.
4. Now enter file name and click on OK button to create drawable resource xml file.
Note: We have to create XML resource file inside drawable folder to work it correctly.
Источник
duplicated with element declared at AndroidManifest.xml #418
Comments
MohammedSaberMohammed commented Feb 25, 2017 •
hello everyone i have a problem which is the following when i run
—> ionic run android
and this is AndroidManifest.xml
The text was updated successfully, but these errors were encountered:
wildabeast commented Mar 16, 2017
Can’t see your AndroidManifest.xml, please properly escape your code.
jbankester commented Apr 5, 2017
I just ran into the same issue building after updating from v6.0.1 to v6.0.6.
:processReleaseManifest
C:\development\Mobile\platforms\android\AndroidManifest.xml:13:9-18:20 Error:
Element activity#com.google.zxing.client.android.CaptureActivity at AndroidManifest.xml:13:9-18:20 duplicated with element declared at AndroidManifest.xml:11:9-311
C:\development\Mobile\platforms\android\AndroidManifest.xml Error:
Validation failed, exiting
jbankester commented Apr 6, 2017
I found that after removing the plugin
phonegap plugin rm phonegap-plugin-barcodescanner
The following element remained in AndroidManifest.xml and would be added again on each build attempt.
I deleted the top level AndroidManifest.xml as well as the same file from
I also deleted the android.json file from
I was then able to install the latest version of the plugin and build successfully.
macdonst commented Apr 6, 2017
@MMAANNSS so the problem has gone away after removing and re-adding the platform?
jbankester commented Apr 6, 2017
Yeah, I initially tried just removing the extra element from AndroidManifest.xml but it gets put back in there if you don’t get rid of it everywhere.
thomasblom commented Jun 26, 2017
I still have this problem. The steps of jbankester to delete the manifest and install the plugin again and build for Android did not work. Does anyone else have a solution?
giscafer commented Jul 13, 2017
Error: cmd: Command failed with exit code 1 Error output: F:\workspace\app-jzt\platforms\android\AndroidManifest.xml:131:5-65 Error: Element uses-permission#android.permission.CAMERA at AndroidManifest.xml:131:5-65 duplicated with element declared at AndroidManifest.xml:130:5-90 F:\workspace\app-jzt\platforms\android\AndroidManifest.xml:132:5-60 Error: Element uses-feature#android.hardware.camera at AndroidManifest.xml:132:5-60 duplicated with element declared at AndroidManifest.xml:128:5-85 F:\workspace\app-jzt\platforms\android\AndroidManifest.xml Error: Validation failed, exiting
teckyin commented Jul 31, 2017
@MMAANNSS Hi, I’m having the same issue with «duplicated element declared at AndroidManifest.xml» after I’ve installed this barcode scanner. But for my case, there’s multiple permission request on Camera and the cause of this issue is having cordova-plugin-qrscanner and phonegap-plugin-barcodescanner installed and both of the plugins is requesting the same permission. After I’ve removed the cordova-plugin-qrscanner everything went smooth.
jaufgang commented Aug 18, 2017 •
Does this mean it is not possible to have multiple plugins that use the camera used by a cordova app, even if the app does not use both plugins at the same time? Simply because they both need to ask for the same permission?
Источник