Error parsing XML: junk after document element - Building an Icon Pack - android

I´m currently creating an free Material Design Icon Pack following [this][1] tutorial (I don´t have much experience in coding) in Eclipse. After I added some of my Icons to the applifter.xml and declared them in the iconpack.xml I get this Error when I´m trying to build it:
[2015-02-26 16:10:35 - Materialism] C:\Users\...\workspace\Materialism\res\values\iconpack.xml:10: error: Error parsing XML: junk after document element
[2015-02-26 16:10:35 - Materialism]
[2015-02-26 16:10:35 - Materialism] C:\Users\...\workspace\Materialism\res\xml\appfilter.xml:12: error: Error parsing XML: junk after document element
[2015-02-26 16:10:35 - Materialism]
[2015-02-26 16:12:30 - Materialism] Error in an XML file: aborting build.
It says "the markup in the document following the root document must be well formed"
This is my applifter.xml:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<iconback img1="iconback" />
<iconmask img1="iconmask" />
<iconupon img1="iconupon" />
<scale factor="1.1" />
<!-- Browser -->
<item component="ComponentInfo{com.android.browser/com.android.browser.BrowserActivity}" drawable="com_android_browser_browseractivity" />
<item component="ComponentInfo{com.google.android.browser/com.android.browser.BrowserActivity}" drawable="com_android_browser_browseractivity" />
</resources>
<item component="ComponentInfo{com.djit.bassboostforandroidpro/com.djit.bassboost.MainActivity}" drawable="bassbooster"
<item component="ComponentInfo{com.devhd.feedly/com.devhd.feedly.Main}" drawable="feedly"
<item component="ComponentInfo{com.rhapsody.napster/com.rhapsodycore.SplashScreen}" drawable="napster"
<item component="ComponentInfo{com.netflix.mediaclient/com.netflix.mediaclient.UIWebViewActivity}" drawable="netflix"
<item component="ComponentInfo{com.android.stk/com.android.stk.StkMenuActivity}" drawable="simtoolkit"
<item component="ComponentInfo{com.snapchat.android/com.snapchat.android.LandingPageActivity}" drawable="snapchat"
<item component="ComponentInfo{com.rarlab.rar/com.rarlab.rar.MainActivity}" drawable="rar"
<item component="ComponentInfo{com.keramidas.TitaniumBackup/com.keramidas.TitaniumBackup.MainActivity}" drawable="titaniumbackup"
And the iconpack.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="icon_pack" translatable="false">
<item>com_android_browser_browseractivity</item>
</string-array>
</resources>
<string-array name="icon_pack" translatable="false">
<item>bassbooster</item>
</string-array>
<string-array name="icon_pack" translatable="false">
<item>feedly</item>
</string-array>
<string-array name="icon_pack" translatable="false">
<item>napster</item>
</string-array>
<string-array name="icon_pack" translatable="false">
<item>netflix</item>
</string-array>
<string-array name="icon_pack" translatable="false">
<item>rar</item>
</string-array>
<string-array name="icon_pack" translatable="false">
<item>simtoolkit</item>
</string-array>
How can I resolve this?
Thank in advance :-)

XML files have a strictly defined structure which you must follow. In this case everything must be between the
<resources>
.... everything must be here ....
</resources>
tags. Putting anything after the </resources> will result in the 'not well formed error'. (The <?xml version="1.0" encoding="utf-8"?> is the exception and must be first).
Also some of your
<item component="ComponentInfo{com.djit.bassboostforandroidpro/com.djit.bassboost.MainActivity}" drawable="bassbooster"
values do not end properly. There must be a /> at the end of each item - like this:
<item component="ComponentInfo{com.djit.bassboostforandroidpro/com.djit.bassboost.MainActivity}" drawable="bassbooster" />

Related

How to make modules/library resources private android

I do according to documentation
module common created
res/values/public.xml
<resources>
<public name="app_name" type="string"/>
</resources>
Also tried
<resources>
<public/>
</resources>
res/values/strings.xml
<resources>
<string name="app_name">app_name</string>
<string name="app_name_2">app_name_2</string>
</resources>
Also tried without public.xml
res/values/strings.xml
<resources>
<public name="app_name" type="string"/>
<string name="app_name">app_name</string>
<string name="app_name_2">app_name_2</string>
</resources>
<resources>
<public />
<string name="app_name">app_name</string>
<string name="app_name_2">app_name_2</string>
</resources>
module app can use private resources
android.example.common.R.string.app_name_2
I think the problem is from Android Developers side, because their video says how private resources should work, but they don't work that.
That's why I created an IssueTracker request, everyone who is affected can vote (upper right corner) so that Google pays attention to the error.

Values inside items in string-array xml

Is something like this possible??
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="planets_array">
<item value=My >Mercury</item>
<item value=Vs >Venus</item>
<item value=EA >Earth</item>
<item value=Ms >Mars</item>
</string-array>
</resources>
the listView will show the planets but when the user selects Mars
the value I get will be Ms.
No, there is no such direct way to use string array in android app resources. One of my suggestion is separate the label and value to two different string arrays, then use these string arrays in your code.
<string-array name="planet_label">
<item>Mercury</item>
<item>Venus</item>
<item>Earth</item>
<item>Mars</item>
</string-array>
<string-array name="planet_values">
<item>My</item>
<item>Vs</item>
<item>Ea</item>
<item>Ms</item>
</string-array>

android string-array item attributes

I have string array like this:
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<string-array name="my_videos">
<item>bunny.mp4</item>
<item>bunny.m4a</item>
<item>bunny.3gp</item>
</string-array>
And in my app I have this:
String product = ((TextView) view).getText().toString();
Now I want to put some normal text like this:
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<string-array name="my_videos">
<item name="bunny.mp4">Movie description 1</item>
<item name="bunny.m4a">Movie description 2</item>
<item name="bunny.3gp">Movie description 3</item>
</string-array>
Now I want to acces name attribute and not get text.
I am new to Android and do not know if this is possible.
Please help.

android - frame animation in value/arrays.xml

i have simple anim
simple_anim.xml
<animation-list xmlns:android=”http://schemas.android.com/apk/res/android” id=”selected” android:oneshot=”false”>
<item android:drawable=”#drawable/frame1″ android:duration=”50″ />
<item android:drawable=”#drawable/frame2″ android:duration=”50″ />
</animation-list>
it is possible to create frame animation in value/arrays.xml
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<array name="entries">
<item>#drawable/simple_anim</item>
<item>#drawable/image2</item>
<item>#drawable/image3</item>
<item>#drawable/image4</item>
<item>#drawable/image5</item>
</array>
</resources>
Technically yes. But not in the same way you would use the first one. You could start a thread that on each run displays the next image resource in your array.

XML Code Not Working

I am a beginner at coding Android Apps.
Here is my XML code under arrays.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<array name="difficulty">
<item>"#string/easy_label"</item>
<item>"#string/medium_label"</item>
<item>"#string/hard_label"</item>
</array>
</resources>
"#string/easy_label" and the other labels are not highlighted a color. I'm assuming my program won't run because there is a problem here. Does anyone know how I can re-adjust this to make my Android program work?
On a side note: I have easy_label, medium_label, and hard_label all declared in strings.xml, so I don't think the reference to strings.xml is the problem.
What if you do it without double quotes:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<array name="difficulty">
<item>#string/easy_label</item>
<item>#string/medium_label</item>
<item>#string/hard_label</item>
</array>
</resources>

Categories

Resources