i am trying to display Listview control in android app and here is my xml file:
what i am doing wrong?
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="countries">
<item name="usa">Unites States</item>
<item name="kwt">Kuwait</item>
<item name="sa">Sudia Arabia</item>
<item name="uae">United Arab Emirates</item>
<item name="afghan">Afghanstan</item>
</string-array>
</resources>
Error:
[2012-01-08 19:58:24 - ListControls] Error in an XML file: aborting build.
There are a few other questions here on Stackoverflow that may address your problem:
Error starting an Android program
It's worth searching Stackoverflow or the web for error message strings etc. before posting a new question (if you didn't do this).
Try closing Eclipse, then run it again.
i copy your code to eclipse, it work right.
so, may be the eclipse build has some problem, suggestion clean your project and rebuild.
[2012-01-08 19:58:24 - ListControls] Error in an XML file: aborting build.
and maybe your error is not the xml file error.
Related
Couldn't resolve resource #id/visible when using TextInputLayout on appcompat-v7:25.x.x
Tried these steps below, but the problem is still persist:
Rebuild Project
Clean and Rebuild Project
Clear Cache and
Restart Android Studio
Below is the code in the layout file.
<android.support.design.widget.TextInputLayout
android:id="#+id/tilFirstName"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="#+id/etFirstName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/first_name"
android:inputType="textPersonName"/>
</android.support.design.widget.TextInputLayout>
Below is the message displayed in Android Studio
Rendering Problems.
Couldn't resolve resource #id/visible
Tip: Try to refresh the layout.
NOTE: #id/visible is not present in the code.
This nags one with the Rendering Problems window
How to fix: add these values to any values file (the filename doesn't appear to matter, I use ids.xml, you can use an existing one as well, such as colors.xml or strings.xml)
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="visible" type="id"/>
<item name="masked" type="id"/>
</resources>
It most likely is a bug, and it has been filed in the Issue Tracker.
Meanwhile, you may try to switch the API version in the editor to 19 or below, though you may see some minor differences in the design output.
No Need To Change API
Couldn't resolve resource #string/faq_customer_service
or
Couldn't resolve resource #id/visible
or
Couldn't resolve resource #id/masked
The solution is if you implement TextInputLayout the above problems may arise ... so Simply add those id or strings to xml files as their property.
Add the value below tag in strings.xml file:
<item name="visible" type="id"/>
<item name="masked" type="id"/>
I am trying to run an Application that I downloaded the source code from the internet and having problems.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item
type="holder"
name="id_name" />
<item
type="categorie"
name="id_name" />
</resources>
The error I get is
app\src\main\res\values\id2.xml: Error: Unsupported type 'holder'' and cannot resolve symbol 'holder'.
How do I get over this?
It is because you can use only below types in an item tag.
And types can contain a reference for above-listed values.
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?
First off forgive me if I posted this question wrong. I've used stackoverflow for many problems but this is the first time I couldnt already find an answer to my problem. So, if I'm doing something wrong please let me know and I'll repost / edit the question.
Now unto business. I've just recently started development w/ the Android SDK and I'm following the basic tutorial from http://developer.android.com/resources/tutorials/hello-world.html#avd
I've gotten up the xml editting part and when I make all the changes to the xml files main.xml and strings.xml this error occurs. Also, when I compile the project, the compilation process generates a main.out.xml file that is empty. I don't know what it is or its purpose.
The error:
[2011-12-30 16:10:02 - Hello Razor] res\layout\main.xml:0: error: Resource entry main is already defined.
[2011-12-30 16:10:02 - Hello Razor] res\layout\main.out.xml:0: Originally defined here.
[2011-12-30 16:10:02 - Hello Razor] C:\Users\Dux69\workspace\Hello Razor\res\layout\main.out.xml:1: error: Error parsing XML: no element found
[2011-12-30 16:10:13 - Hello Razor] Error in an XML file: aborting build.
My project is setup for platform: Android 2.3.3 API Level: 10
I don't know if it makes a difference or not but I'm using my Android Incredible for running/debugging the application not a Android Virtual Device. If there is any more information needed let me know and I'll post it ASAP.
Here are the three code files I'm using:
main.xml
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/textview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:text="#string/hello_O" />
strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello_O">Baba in the house, Razor Activity!</string>
<string name="app_name">Hello Razor App</string>
</resources>
razorActivity.java
package hello.Razor;
import android.R;
import android.app.Activity;
import android.os.Bundle;
public class razorActivity extends Activity
{
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
I had a similar problem once.
Rebuilding/cleaning the project and restarting Eclipse helped for me.
delete the main.out.xml in project view and re-run as android application
Error message I got:
Error:(43) Error parsing XML: no element found
and
Error:Execution failed for task ':app:processDebugResources'.
com.android.ide.common.process.ProcessException: Failed to execute aapt
Solution: In my case, project activity_main.xml is initiated with the code
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.batvibes.battybirthday.Main1Activity">
and I forgot the below end tag.
</android.support.constraint.ConstraintLayout>
Disclaimer: I am totally new to android development. My suggestion, please check all tags opening and closing and go to next step of debugging.
Try to end your Main or Sub Layout like:
</LinearLayout>
Flush with success on getting "hello Android" to run, I'm working on the tutorial at link text using Eclipse. When I create the android_button.xml file in res/drawable/, I get errors for each of the in
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="#drawable/android_pressed"
android:state_pressed="true" />
<item android:drawable="#drawable/android_focused"
android:state_focused="true" />
<item android:drawable="#drawable/android_normal" />
</selector>
The errors (repeated for each item) are:
Description Resource Location Type Path
error: Error: No resource found that matches the given name (at 'drawable' with value '#drawable/android_focused'). android_button.xml line 5 Android AAPT Problem /HelloFormStuff/res/drawable
error: Error: No resource found that matches the given name (at 'drawable' with value '#drawable/android_focused'). android_button.xml line 5 Android AAPT Problem /HelloFormStuff/res/drawable
I'm afraid I don't know which resource should match the names or if I have overlooked something or misnamed something. Help resolving this is greatly appreciated!
You probably missed this line in the instructions:
Copy the images on the right into the res/drawable/ directory of your project. These will be used for the different button states.
Just copy those little android icons into the directory and it should work
On the link you gave there are three android icons near
android_button.xml code. Just right click them and "save as"
Save them in your res/drawable directory along with android_button.xml.
note that I assume you are creating that xml file in res/drawable directory
and note in drawable-XXXX directory created by eclipse. You will have to manually
create a new folder drawable in res directory, since its not default eclipse stuff.