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 com.android.dx.ssa.SsaMethod.getGoto(Ssa Method.java :231)
..............
...............

Thanks

Sandy

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Shape drawing - issue with corners

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

<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 
resource.  

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: ";
try
{
int eventType = xpp.getEventType();
while (eventType!=XmlPullParser.END_DOCUMENT)
{
if (eventType==XmlPullParser.START_TAG)
ReadTag(xpp, target.getClass(),target);
eventType = xpp.next();
}
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)
{

e.printStackTrace();
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;
lead_tag+="\t";
try
{
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);
try
{
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
xpp.next();
int eventType = xpp.getEventType();
while (eventType!=XmlPullParser.END_DOCUMENT && 
eventType!=XmlPullParser.END_TAG)
{
if (xpp.getEventType()==XmlPullParser.START_TAG)
{
String tagname = xpp.getName ();
if (verbose) FlightPanel.LocalLog(TAG, lead_tag+" >> diving into complex XML 
tag  " + tagname);
try
{
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 " + 
tagname);
FlightPanel.LocalLog(TAG, lead_tag+" error " + e.toString());
}
}
eventType = xpp.next();
}

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

}
catch (Exception e)
{
e.printStackTrace();
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
DRC92
cricket/zio/msm7627_kb60/zio:1.6/DRC92/Android.1.002CR.1:user/ota-rel-keys,release-keys
TAGS:release-keys
1281453694000
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