There is nothing in the program trying to reference an array yet. I can create the array.xml file in the values folder without effecting how the program runs, but as soon as i add a string-array (without any items), the program crashes on load. Im so confused with what to do. Here is what the xml looks like:

<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="language">
    <item>English</item>
    <item>German</item> 
    <item>Russian</item>
    <item>Italian</item>
</string-array>
</resources>

as soon as i delete this xml, the program runs fine. I tried using different array names and values, i tried doing an Integer array and it does not help.

link

share|improve this question

43% accept rate
1  
Show us the code that you're using to add the string array? – t0mm13b Oct 9 at 21:34
Can you show us the logcat of the crash? I have a feeling it's just aapt being dumb (usually requires a clean after a new xml file added on some platforms). – Greg Giacovelli Oct 9 at 21:37
@t0mm13b - I am just adding the string array in the res.values.arrays.xml file – Troy Loberger Oct 9 at 21:41
1  
Cannot read the logcat! – t0mm13b Oct 9 at 21:46
1  
Um you couldn't even copy and paste the log cat? Really? Dude that's just mean. – Greg Giacovelli Oct 9 at 21:49
show 5 more comments
feedback

closed as too localized by t0mm13b, Sam, Mark Oreta, tchrist, Lucifer Oct 10 at 2:32

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.

1 Answer

Uhhh... should that not be arrays.xml.

It seems the filename is what threw off the application and caused it to crash!

share|improve this answer
I tried arrays.xml as well it did not help – Troy Loberger Oct 9 at 21:45
Are you 100% positive that you think the problem is the XML and not a nullpointer exception? – t0mm13b Oct 9 at 21:52
I think it's aapt rearranging the ids when you add the value in the xml file. Sometimes aapt tries to be smart and cache things that didn't change. So you end up with stuff like, TextView a = findViewById(R.id.text); all of a sudden start failing when you edit a non related xml file. So in that case, the failure would be the code would return null and then later on your would use the variable and all hell breaks loose. I have no clue way, but I usually just end up cleaning which forces a full rebuild of the Resource map. It's super lame and it happens on OSX for me more than anything. – Greg Giacovelli Oct 9 at 22:00
@GregGiacovelli Squinting from the bottom of the logcat, it seems the testing instrumentation was launched, maybe its aapt playing silly buggers but the OP clearly has not included the code, yet nullpointer exception being thrown so its 50-50 either way. – t0mm13b Oct 9 at 22:14
feedback

Not the answer you're looking for? Browse other questions tagged or ask your own question.