cannot compile source with OoO issue.

by Sandy » Fri, 13 Mar 2009 01:42:42 GMT

Sponsored Links
 Hi All

I experienced one issue when I try to build my app.

java.lang.OutOfMemoryError: Java heap space :
at :231)




Other Threads

1. Shape drawing - issue with corners

The docs say you should do the following if you only want some corners

<corners android:radius="15dp" android:bottomRightRadius="0dip"
android:bottomLeftRadius="0dip" />

Never got that it work tho.


2. Problem with XMLPullParser and/or Java reflection on specific devices (zio) ?

A new problem has shown up with my app, which appears to affect only certain 
devices. I don't have a lot of information about the failure, but my current 
best guess is it appears to be failing to read or parse an internal XML 

I read one of several XML files from res/xml and use that to dynamically 
initialize a java class / data structure (ie: coordinates of bitmaps based 
on a skin definition -- not device, region, or resolution dependent). 
 There's nothing device-specific there, so it seems like if that had a 
problem, it wouldn't be specific to any one device.  And that method has 
been working fine for a long time, across many resolutions, languages, and 
devices from 1.5 to 2.2+  -- but I recently got a vague report that suggests 
it's not working with a Sanyo / Kyocera Zio (on Cricket) running 1.6  -- and 
possibly also on some tablet of unknown make and model (but not a Galaxy 
Tab).  The failure mode suggests that it is able to find the XML from the 
resources, but the data is not making it from the XML to the java class.  

If I had access to a device (or a patient tester with one) I could probably 
solve this with detailed logging, but at the moment, I'm stuck.  Does anyone 
have any ideas or similar experience?


Here is the code for the class which takes a Resource and ID and a Java 
object and assigns any properties with the same name in the XML to the Java 
object. (apologies if this method is outdated / bad practice / etc.  I wrote 
it when I was just starting on Android and java is not my native tongue.).  

package lars.FlightPanel;

import org.xmlpull.v1.XmlPullParser;
import android.content.res.Resources;
import java.lang.reflect.*;
import java.lang.Class;

public class XMLClassReader

private static final String TAG = "XMLClassReader";
private String lead_tag;
private boolean verbose = false;

XMLClassReader () { } ;

public Object Read (int resourceID, Object target,Resources R)
XmlPullParser xpp = R.getXml(resourceID);
return Read (xpp,target);

public Object Read (XmlPullParser xpp, Object target)

lead_tag = "XMLParser: ";
int eventType = xpp.getEventType();
while (eventType!=XmlPullParser.END_DOCUMENT)
if (eventType==XmlPullParser.START_TAG)
ReadTag(xpp, target.getClass(),target);
eventType =;
Field fld = target.getClass().getDeclaredField("XML_Loaded");
// FlightPanel.LocalLog(TAG, lead_tag+"field is " + fld + " in " + target);
if (fld!=null)
fld.setInt (target, Integer.parseInt("1"));
FlightPanel.LocalLog(TAG, lead_tag+" done loading all.");
catch (Exception e)

FlightPanel.LocalLog(TAG, lead_tag+" error " + e.toString());
return target;


private void ReadTag (XmlPullParser xpp, Class cls,Object target)
String orig_lead_tag = lead_tag;
String thistag = xpp.getName();
if (verbose ) FlightPanel.LocalLog(TAG, lead_tag+" starting parsing of XML 
tag " + thistag);
if (verbose) FlightPanel.LocalLog(TAG, lead_tag+" - into class " + 
cls.getName() + " containing :");
Field[] flds = cls.getDeclaredFields();
for (int x=0;x<flds.length;x++)
if (verbose)  FlightPanel.LocalLog(TAG, lead_tag+" -- " + flds[x].getName() 
+ " \t " + flds[x]);
int index;

// read the primitives out as attributes
for (index = 0; index < xpp.getAttributeCount();index++)
String attributeName = xpp.getAttributeName(index);
Field fld = cls.getDeclaredField(attributeName);
String value = xpp.getAttributeValue(index);
if (verbose) FlightPanel.LocalLog(TAG, lead_tag+" = matched XML attribute " 
+ attributeName + "\t assigning value "+ value);
String typname = fld.getType().getName();
if (verbose) FlightPanel.LocalLog(TAG, lead_tag+" == to field \t" + fld + " 
of type " + fld.getType() + " \t "  + typname);
if (verbose) FlightPanel.LocalLog(TAG, lead_tag+" == on object \t" + target 
+ "  \t " + target.getClass());
if (typname.equals("int"))
fld.setInt (target, Integer.parseInt(value));
else if (typname.equals("float"))
fld.setFloat (target, Float.parseFloat(value));
else if (typname.equals("boolean"))
fld.setBoolean (target, Boolean.parseBoolean(value));
else if (typname.equals("double"))
fld.setDouble (target, Double.parseDouble(value));
else if (typname.equals("byte"))
fld.setByte (target, Byte.parseByte(value));
else if (typname.equals("short"))
fld.setShort (target, Short.parseShort(value));
else if (typname.equals("long"))
fld.setLong (target, Long.parseLong(value));
// todo:  add strings and arrays

catch (Exception e)
FlightPanel.LocalLog(TAG, lead_tag+" error no field matching XML attribute " 
+ attributeName);
FlightPanel.LocalLog(TAG, lead_tag+" error " + e.toString());


// read any subclasses;
int eventType = xpp.getEventType();
while (eventType!=XmlPullParser.END_DOCUMENT && 
if (xpp.getEventType()==XmlPullParser.START_TAG)
String tagname = xpp.getName ();
if (verbose) FlightPanel.LocalLog(TAG, lead_tag+" >> diving into complex XML 
tag  " + tagname);
Field fld = cls.getDeclaredField(tagname);
ReadTag(xpp, fld.getType(), fld.get(target));
catch (Exception e)
FlightPanel.LocalLog(TAG, lead_tag+" error  no field matching XML tag " + 
FlightPanel.LocalLog(TAG, lead_tag+" error " + e.toString());
eventType =;

if (verbose) FlightPanel.LocalLog(TAG, lead_tag+" done with  " + thistag);

catch (Exception e)
FlightPanel.LocalLog(TAG, lead_tag+" error " + e.toString());
lead_tag = orig_lead_tag;



and the system & build report from the one offending device's profile is: 

zio cricket
user DRC92 Android-BS7 cmd_public


3. notification help

4. Problem running Android JUnit Test on eclipse

5. clicking an auto link from dataadapter how to set flag new activity

6. Need help with Google Map

7. wifi driver on gumstix overo